pandas.Series.dt.days#

Series.dt.days[source]#

Number of days for each element.

See also

Series.dt.seconds

Return number of seconds for each element.

Series.dt.microseconds

Return number of microseconds for each element.

Series.dt.nanoseconds

Return number of nanoseconds for each element.

Examples

For Series:

>>> ser = pd.Series(pd.to_timedelta([1, 2, 3], unit='D'))
>>> ser
0   1 days
1   2 days
2   3 days
dtype: timedelta64[ns]
>>> ser.dt.days
0    1
1    2
2    3
dtype: int64

For TimedeltaIndex:

>>> tdelta_idx = pd.to_timedelta(["0 days", "10 days", "20 days"])
>>> tdelta_idx
TimedeltaIndex(['0 days', '10 days', '20 days'],
                dtype='timedelta64[ns]', freq=None)
>>> tdelta_idx.days
Index([0, 10, 20], dtype='int64')