pandas.TimedeltaIndex.days#

property TimedeltaIndex.days[source]#

Number of days 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')