Skip to content

Commit 0bd8138

Browse files
authored
DOC: Improve to_datetime() documentation (#41049)
1 parent 83e4332 commit 0bd8138

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pandas/core/tools/datetimes.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -855,8 +855,19 @@ def to_datetime(
855855
856856
>>> pd.to_datetime([1, 2, 3], unit='D',
857857
... origin=pd.Timestamp('1960-01-01'))
858-
DatetimeIndex(['1960-01-02', '1960-01-03', '1960-01-04'], \
859-
dtype='datetime64[ns]', freq=None)
858+
DatetimeIndex(['1960-01-02', '1960-01-03', '1960-01-04'],
859+
dtype='datetime64[ns]', freq=None)
860+
861+
In case input is list-like and the elements of input are of mixed
862+
timezones, return will have object type Index if utc=False.
863+
864+
>>> pd.to_datetime(['2018-10-26 12:00 -0530', '2018-10-26 12:00 -0500'])
865+
Index([2018-10-26 12:00:00-05:30, 2018-10-26 12:00:00-05:00], dtype='object')
866+
867+
>>> pd.to_datetime(['2018-10-26 12:00 -0530', '2018-10-26 12:00 -0500'],
868+
... utc=True)
869+
DatetimeIndex(['2018-10-26 17:30:00+00:00', '2018-10-26 17:00:00+00:00'],
870+
dtype='datetime64[ns, UTC]', freq=None)
860871
"""
861872
if arg is None:
862873
return None

0 commit comments

Comments
 (0)