@@ -142,19 +142,42 @@ you can pass the ``dayfirst`` flag:
142
142
can't be parsed with the day being first it will be parsed as if
143
143
``dayfirst `` were False.
144
144
145
+ Invalid Data
146
+ ~~~~~~~~~~~~
145
147
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):
147
149
148
150
.. ipython :: python
149
151
150
152
to_datetime([' 2009-07-31' , ' asd' ])
151
153
152
154
to_datetime([' 2009-07-31' , ' asd' ], coerce = True )
153
155
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
+
154
166
It's also possible to convert integer or float epoch times. The default unit
155
167
for these is nanoseconds (since these are how Timestamps are stored). However,
156
168
often epochs are stored in another ``unit `` which can be specified:
157
169
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.
158
181
159
182
.. ipython :: python
160
183
@@ -166,12 +189,6 @@ often epochs are stored in another ``unit`` which can be specified:
166
189
167
190
Epoch times will be rounded to the nearest nanosecond.
168
191
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
-
175
192
.. _timeseries.daterange :
176
193
177
194
Generating Ranges of Timestamps
@@ -1116,8 +1133,8 @@ to determine the right offset.
1116
1133
.. ipython :: python
1117
1134
:okexcept:
1118
1135
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' ,
1121
1138
' 11/06/2011 03:00' ])
1122
1139
rng_hourly.tz_localize(' US/Eastern' )
1123
1140
rng_hourly_eastern = rng_hourly.tz_localize(' US/Eastern' , infer_dst = True )
0 commit comments