@@ -200,6 +200,8 @@ def to_datetime(arg, errors='ignore', dayfirst=False, utc=None, box=True,
200
200
If True, require an exact format match.
201
201
If False, allow the format to match anywhere in the target string.
202
202
coerce : force errors to NaT (False by default)
203
+ Timestamps outside the interval between Timestamp.min and Timestamp.max
204
+ (approximately 1677-09-22 to 2262-04-11) will be also forced to NaT.
203
205
unit : unit of the arg (D,s,ms,us,ns) denote the unit in epoch
204
206
(e.g. a unix timestamp), which is an integer/float number
205
207
infer_datetime_format : boolean, default False
@@ -212,6 +214,9 @@ def to_datetime(arg, errors='ignore', dayfirst=False, utc=None, box=True,
212
214
- list-like: DatetimeIndex
213
215
- Series: Series of datetime64 dtype
214
216
- scalar: Timestamp
217
+ In case when it is not possible to return designated types (e.g. when
218
+ any element of input is before Timestamp.min or after Timestamp.max)
219
+ return will have datetime.datetime type (or correspoding array/Series).
215
220
216
221
Examples
217
222
--------
@@ -226,6 +231,11 @@ def to_datetime(arg, errors='ignore', dayfirst=False, utc=None, box=True,
226
231
227
232
>>> df = df.astype(str)
228
233
>>> pd.to_datetime(df.day + df.month + df.year, format="%d%m%Y")
234
+
235
+ Date that does not meet timestamp limitations:
236
+
237
+ >>> print pd.to_datetime('1300-01-01', format='%Y-%m-%d')
238
+ >>> print pd.to_datetime('1300-01-01', format='%Y-%m-%d', coerce=True)
229
239
"""
230
240
from pandas import Timestamp
231
241
from pandas .core .series import Series
0 commit comments