Time series information from various sources and formats.

Convert a recognized date format or value into a DateTime type

In [3]:
pd.to_datetime(dates)
Out[3]:
DatetimeIndex(['2018-01-01', '2018-01-01', '2018-01-01'], dtype='datetime64[ns]', freq=None)

Use the DatetimeIndex constructor directly.

In [4]:
pd.DatetimeIndex(dates)
Out[4]:
DatetimeIndex(['2018-01-01', '2018-01-01', '2018-01-01'], dtype='datetime64[ns]', freq=None)

Convert a column to datetime.

In [5]:
pd.to_datetime(pd.Series(dates))
Out[5]:
0   2018-01-01
1   2018-01-01
2   2018-01-01
dtype: datetime64[ns]