Skip to main content
`Ctrl`+`K`

# pandas.arrays.TimedeltaArray

class pandas.arrays.TimedeltaArray(data, dtype=None, freq=None, copy=False)

  Pandas ExtensionArray for timedelta data.

  Warning

  TimedeltaArray is currently experimental, and its API may change without warning. In particular, `TimedeltaArray.dtype` is expected to change to be an instance of an `ExtensionDtype` subclass.

  Parameters:
    data array-like

      The timedelta data.

    dtype numpy.dtype

      Valid `numpy` dtypes are `timedelta64[ns]`, `timedelta64[us]`, `timedelta64[ms]`, and `timedelta64[s]`.

    freq Offset, optional

      Frequency of the data.

    copy bool, default False

      Whether to copy the underlying array of data.

  Attributes

  None |

  Methods

  None |

  See also

  `Timedelta`

    Represents a duration, the difference between two dates or times.

  `TimedeltaIndex`

    Immutable Index of timedelta64 data.

  `to_timedelta`

    Convert argument to timedelta.

  Examples

      >>> pd.arrays.TimedeltaArray._from_sequence(pd.TimedeltaIndex(["1h", "2h"]))
      <TimedeltaArray>
      ['0 days 01:00:00', '0 days 02:00:00']
      Length: 2, dtype: timedelta64[us]