pandas.Series.dt#
- Series.dt()[source]#
Accessor object for Series values’ datetime-like, timedelta and period properties.
See also
DatetimeIndex
Index of datetime64 data.
Examples
>>> dates = pd.Series( ... ["2024-01-01", "2024-01-15", "2024-02-5"], dtype="datetime64[ns]" ... ) >>> dates.dt.day 0 1 1 15 2 5 dtype: int32 >>> dates.dt.month 0 1 1 1 2 2 dtype: int32
>>> dates = pd.Series( ... ["2024-01-01", "2024-01-15", "2024-02-5"], dtype="datetime64[ns, UTC]" ... ) >>> dates.dt.day 0 1 1 15 2 5 dtype: int32 >>> dates.dt.month 0 1 1 1 2 2 dtype: int32