Skip to content

Commit

Permalink
DOC: Improve to_datetime() documentation (#41049)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmayrane authored Apr 21, 2021
1 parent 83e4332 commit 0bd8138
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pandas/core/tools/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,19 @@ def to_datetime(
>>> pd.to_datetime([1, 2, 3], unit='D',
... origin=pd.Timestamp('1960-01-01'))
DatetimeIndex(['1960-01-02', '1960-01-03', '1960-01-04'], \
dtype='datetime64[ns]', freq=None)
DatetimeIndex(['1960-01-02', '1960-01-03', '1960-01-04'],
dtype='datetime64[ns]', freq=None)
In case input is list-like and the elements of input are of mixed
timezones, return will have object type Index if utc=False.
>>> pd.to_datetime(['2018-10-26 12:00 -0530', '2018-10-26 12:00 -0500'])
Index([2018-10-26 12:00:00-05:30, 2018-10-26 12:00:00-05:00], dtype='object')
>>> pd.to_datetime(['2018-10-26 12:00 -0530', '2018-10-26 12:00 -0500'],
... utc=True)
DatetimeIndex(['2018-10-26 17:30:00+00:00', '2018-10-26 17:00:00+00:00'],
dtype='datetime64[ns, UTC]', freq=None)
"""
if arg is None:
return None
Expand Down

0 comments on commit 0bd8138

Please sign in to comment.