Skip to content

Commit 988397f

Browse files
author
Vladimir Filimonov
committed
Docstring: pd.to_datetime (issue #9107)
1 parent b3d1a05 commit 988397f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tseries/tools.py

+10
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ def to_datetime(arg, errors='ignore', dayfirst=False, utc=None, box=True,
200200
If True, require an exact format match.
201201
If False, allow the format to match anywhere in the target string.
202202
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.
203205
unit : unit of the arg (D,s,ms,us,ns) denote the unit in epoch
204206
(e.g. a unix timestamp), which is an integer/float number
205207
infer_datetime_format : boolean, default False
@@ -212,6 +214,9 @@ def to_datetime(arg, errors='ignore', dayfirst=False, utc=None, box=True,
212214
- list-like: DatetimeIndex
213215
- Series: Series of datetime64 dtype
214216
- 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).
215220
216221
Examples
217222
--------
@@ -226,6 +231,11 @@ def to_datetime(arg, errors='ignore', dayfirst=False, utc=None, box=True,
226231
227232
>>> df = df.astype(str)
228233
>>> 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)
229239
"""
230240
from pandas import Timestamp
231241
from pandas.core.series import Series

0 commit comments

Comments
 (0)