Time delta information from various sources and formats.

Convert a recognized timedelta format or value into a Timedelta type

In [3]:
pd.to_timedelta(deltas)
Out[3]:
TimedeltaIndex(['1 days 00:00:00', '1 days 00:00:05', '2 days 00:00:00',
                '2 days 00:00:02'],
               dtype='timedelta64[ns]', freq=None)

Use the TimedeltaIndex constructor directly.

In [4]:
pd.TimedeltaIndex(deltas)
Out[4]:
TimedeltaIndex(['1 days 00:00:00', '1 days 00:00:05', '2 days 00:00:00',
                '2 days 00:00:02'],
               dtype='timedelta64[ns]', freq=None)

Convert a column to timedelta.

In [5]:
pd.to_timedelta(pd.Series(deltas))
Out[5]:
0   1 days 00:00:00
1   1 days 00:00:05
2   2 days 00:00:00
3   2 days 00:00:02
dtype: timedelta64[ns]