On this page
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.dtypeis expected to change to be an instance of anExtensionDtypesubclass.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
asi8Integer representation of the values. componentsReturn a dataframe of the components (days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds) of the Timedeltas. daysNumber of days for each element. dtypeThe dtype for the TimedeltaArray. freqReturn the frequency object if it is set, otherwise None. freqstrReturn the frequency object as a string if its set, otherwise None inferred_freqTryies to return a string representing a frequency guess, generated by infer_freq. microsecondsNumber of microseconds (>= 0 and less than 1 second) for each element. nanosecondsNumber of nanoseconds (>= 0 and less than 1 microsecond) for each element. nbytesThe number of bytes needed to store this object in memory. resolutionReturns day, hour, minute, second, millisecond or microsecond secondsNumber of seconds (>= 0 and less than 1 day) for each element. shapeReturn a tuple of the array dimensions. sizeThe 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 -
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.24.2/reference/api/pandas.arrays.TimedeltaArray.html