pandas.arrays.TimedeltaArray

class pandas.arrays.TimedeltaArray(values, dtype=dtype('<m8[ns]'), freq=None, copy=False)[source]

Pandas ExtensionArray for timedelta data.

New in version 0.24.0.

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:
values : array-like

The timedelta data.

dtype : numpy.dtype

Currently, only numpy.dtype("timedelta64[ns]") is accepted.

freq : Offset, optional
copy : bool, default False

Whether to copy the underlying array of data.

Attributes

asi8 Integer representation of the values.
components Return a dataframe of the components (days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds) of the Timedeltas.
days Number of days for each element.
dtype The dtype for the TimedeltaArray.
freq Return the frequency object if it is set, otherwise None.
freqstr Return the frequency object as a string if its set, otherwise None
inferred_freq Tryies to return a string representing a frequency guess, generated by infer_freq.
microseconds Number of microseconds (>= 0 and less than 1 second) for each element.
nanoseconds Number of nanoseconds (>= 0 and less than 1 microsecond) for each element.
nbytes The number of bytes needed to store this object in memory.
resolution Returns day, hour, minute, second, millisecond or microsecond
seconds Number of seconds (>= 0 and less than 1 day) for each element.
shape Return a tuple of the array dimensions.
size The number of elements in this array.

Methods

argsort([ascending, kind]) Return the indices that would sort this array.
astype(dtype[, copy]) Cast to a NumPy array with ‘dtype’.
ceil(freq[, ambiguous, nonexistent]) Perform ceil operation on the data to the specified freq.
copy([deep]) Return a copy of the array.
dropna() Return ExtensionArray without NA values
factorize([na_sentinel]) Encode the extension array as an enumerated type.
fillna([value, method, limit]) Fill NA/NaN values using the specified method.
floor(freq[, ambiguous, nonexistent]) Perform floor operation on the data to the specified freq.
isna() A 1-D array indicating if each value is missing.
max([axis, skipna]) Return the maximum value of the Array or maximum along an axis.
min([axis, skipna]) Return the minimum value of the Array or minimum along an axis.
repeat(repeats, *args, **kwargs) Repeat elements of an array.
round(freq[, ambiguous, nonexistent]) Perform round operation on the data to the specified freq.
searchsorted(value[, side, sorter]) Find indices where elements should be inserted to maintain order.
shift([periods, fill_value]) Shift values by desired number.
take(indices[, allow_fill, fill_value]) Take elements from an array.
to_pytimedelta() Return Timedelta Array/Index as object ndarray of datetime.timedelta objects.
total_seconds() Return total duration of each element expressed in seconds.
unique() Compute the ExtensionArray of unique values.
value_counts([dropna]) Return a Series containing counts of unique values.
view([dtype]) New view on this array with the same data.
map  
Scroll To Top