Skip to content

Commit 9f0bf38

Browse files
committed
Clarify doc for converting timestamps to epoch
1 parent bf171d1 commit 9f0bf38

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

doc/source/user_guide/timeseries.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,17 @@ We subtract the epoch (midnight at January 1, 1970 UTC) and then floor divide by
379379
380380
(stamps - pd.Timestamp("1970-01-01")) // pd.Timedelta("1s")
381381
382+
.. note::
383+
384+
385+
We encourage explicitly subtracting 1970-01-01 from the timestamps over using the
386+
``.timestamp`` method because the ``Timestamp.timestamp`` method in pandas exhibits a
387+
distinct behavior compared to ``datetime.timestamp``, particularly in cases involving
388+
timezone-naive (tznaive) instances. Specifically, ``Timestamp.timestamp`` treats
389+
timezone-naive datetime objects as UTC by default while the ``datetime.timestamp``
390+
method treats them as implicitly belonging to the system's local timezone.
391+
392+
382393
.. _timeseries.origin:
383394

384395
Using the ``origin`` parameter

0 commit comments

Comments
 (0)