Skip to content

Commit d73fa1a

Browse files
committed
DOC: timeseries.rst updates
1 parent d52ee75 commit d73fa1a

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

doc/source/timeseries.rst

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,42 @@ you can pass the ``dayfirst`` flag:
142142
can't be parsed with the day being first it will be parsed as if
143143
``dayfirst`` were False.
144144

145+
Invalid Data
146+
~~~~~~~~~~~~
145147

146-
Pass ``coerce=True`` to convert bad data to ``NaT`` (not a time):
148+
Pass ``coerce=True`` to convert invalid data to ``NaT`` (not a time):
147149

148150
.. ipython:: python
149151
150152
to_datetime(['2009-07-31', 'asd'])
151153
152154
to_datetime(['2009-07-31', 'asd'], coerce=True)
153155
156+
157+
Take care, ``to_datetime`` may not act as you expect on mixed data:
158+
159+
.. ipython:: python
160+
161+
to_datetime([1, '1'])
162+
163+
Epoch Timestamps
164+
~~~~~~~~~~~~~~~~
165+
154166
It's also possible to convert integer or float epoch times. The default unit
155167
for these is nanoseconds (since these are how Timestamps are stored). However,
156168
often epochs are stored in another ``unit`` which can be specified:
157169

170+
Typical epoch stored units
171+
172+
.. ipython:: python
173+
174+
to_datetime([1349720105, 1349806505, 1349892905,
175+
1349979305, 1350065705], unit='s')
176+
177+
to_datetime([1349720105100, 1349720105200, 1349720105300,
178+
1349720105400, 1349720105500 ], unit='ms')
179+
180+
These *work*, but the results may be unexpected.
158181

159182
.. ipython:: python
160183
@@ -166,12 +189,6 @@ often epochs are stored in another ``unit`` which can be specified:
166189

167190
Epoch times will be rounded to the nearest nanosecond.
168191

169-
Take care, ``to_datetime`` may not act as you expect on mixed data:
170-
171-
.. ipython:: python
172-
173-
to_datetime([1, '1'])
174-
175192
.. _timeseries.daterange:
176193

177194
Generating Ranges of Timestamps
@@ -1116,8 +1133,8 @@ to determine the right offset.
11161133
.. ipython:: python
11171134
:okexcept:
11181135
1119-
rng_hourly = DatetimeIndex(['11/06/2011 00:00', '11/06/2011 01:00',
1120-
'11/06/2011 01:00', '11/06/2011 02:00',
1136+
rng_hourly = DatetimeIndex(['11/06/2011 00:00', '11/06/2011 01:00',
1137+
'11/06/2011 01:00', '11/06/2011 02:00',
11211138
'11/06/2011 03:00'])
11221139
rng_hourly.tz_localize('US/Eastern')
11231140
rng_hourly_eastern = rng_hourly.tz_localize('US/Eastern', infer_dst=True)

0 commit comments

Comments
 (0)