pandas.TimedeltaIndex#
- class pandas.TimedeltaIndex(data=None, unit=None, freq=_NoDefault.no_default, closed=None, dtype=dtype('<m8[ns]'), copy=False, name=None)[source]#
Immutable Index of timedelta64 data.
Represented internally as int64, and scalars returned Timedelta objects.
- Parameters
- dataarray-like (1-dimensional), optional
Optional timedelta-like data to construct index with.
- unitunit of the arg (D,h,m,s,ms,us,ns) denote the unit, optional
Which is an integer/float number.
- freqstr or pandas offset object, optional
One of pandas date offset strings or corresponding objects. The string ‘infer’ can be passed in order to set the frequency of the index as the inferred frequency upon creation.
- copybool
Make a copy of input ndarray.
- nameobject
Name to be stored in the index.
See also
Index
The base pandas Index type.
Timedelta
Represents a duration between two dates or times.
DatetimeIndex
Index of datetime64 data.
PeriodIndex
Index of Period data.
timedelta_range
Create a fixed-frequency TimedeltaIndex.
Notes
To learn more about the frequency strings, please see this link.
Attributes
Number of days for each element.
Number of seconds (>= 0 and less than 1 day) for each element.
Number of microseconds (>= 0 and less than 1 second) for each element.
Number of nanoseconds (>= 0 and less than 1 microsecond) for each element.
Return a DataFrame of the individual resolution components of the Timedeltas.
Tries to return a string representing a frequency generated by infer_freq.
Methods
to_pytimedelta
(*args, **kwargs)Return an ndarray of datetime.timedelta objects.
to_series
([index, name])Create a Series with both index and values equal to the index keys.
round
(*args, **kwargs)Perform round operation on the data to the specified freq.
floor
(*args, **kwargs)Perform floor operation on the data to the specified freq.
ceil
(*args, **kwargs)Perform ceil operation on the data to the specified freq.
to_frame
([index, name])Create a DataFrame with a column containing the Index.
mean
(*args, **kwargs)Return the mean value of the Array.