pandas.TimedeltaIndex¶
- class pandas.TimedeltaIndex¶
Immutable ndarray of timedelta64 data, represented internally as int64, and which can be boxed to timedelta objects
Parameters: data : array-like (1-dimensional), optional
Optional timedelta-like data to construct index with
unit: unit of the arg (D,h,m,s,ms,us,ns) denote the unit, optional
which is an integer/float number
freq: a frequency for the index, optional
copy : bool
Make a copy of input ndarray
start : starting value, timedelta-like, optional
If data is None, start is used as the start point in generating regular timedelta data.
periods : int, optional, > 0
Number of periods to generate, if generating index. Takes precedence over end argument
end : end time, timedelta-like, optional
If periods is none, generated index will extend to first conforming time on or just past end argument
closed : string or None, default None
Make the interval closed with respect to the given frequency to the ‘left’, ‘right’, or both sides (None)
name : object
Name to be stored in the index
Attributes
T return the transpose, which is by definition self asi8 asobject base return the base object if the memory of the underlying data is shared components Return a dataframe of the components (days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds) of the Timedeltas. data return the data pointer of the underlying data days Number of days for each element. dtype flags freqstr return the frequency object as a string if its set, otherwise None has_duplicates inferred_type is_all_dates is_monotonic alias for is_monotonic_increasing (deprecated) is_monotonic_decreasing return if the index is monotonic decreasing (only equal or is_monotonic_increasing return if the index is monotonic increasing (only equal or itemsize return the size of the dtype of the item of the underlying data microseconds Number of microseconds (>= 0 and less than 1 second) for each element. names nanoseconds Number of nanoseconds (>= 0 and less than 1 microsecond) for each element. nbytes return the number of bytes in the underlying data ndim return the number of dimensions of the underlying data, by definition 1 nlevels seconds Number of seconds (>= 0 and less than 1 day) for each element. shape return a tuple of the shape of the underlying data size return the number of elements in the underlying data strides return the strides of the underlying data values return the underlying data as an ndarray freq hasnans inferred_freq is_unique name resolution Methods
all([other]) any([other]) append(other) Append a collection of Index options together argmax([axis]) return a ndarray of the maximum argument indexer argmin([axis]) return a ndarray of the minimum argument indexer argsort(*args, **kwargs) return an ndarray indexer of the underlying data asof(label) For a sorted index, return the most recent label up to and including the passed label. asof_locs(where, mask) where : array of timestamps astype(dtype) copy([names, name, dtype, deep]) Make a copy of this object. delete(loc) Make a new DatetimeIndex with passed location(s) deleted. diff(*args, **kwargs) difference(other) Compute sorted set difference of two Index objects drop(labels) Make new Index with passed list of labels deleted drop_duplicates([take_last]) Return Index with duplicate values removed duplicated([take_last]) Return boolean np.array denoting duplicate values equals(other) Determines if two Index objects contain the same elements. factorize([sort, na_sentinel]) Encode the object as an enumerated type or categorical variable format([name, formatter]) Render a string representation of the Index get_duplicates() get_indexer(target[, method, limit]) Compute indexer and mask for new index given the current index. get_indexer_for(target, **kwargs) guaranteed return of an indexer even when non-unique get_indexer_non_unique(target) return an indexer suitable for taking from a non unique index get_level_values(level) Return vector of label values for requested level, equal to the length get_loc(key[, method]) Get integer location for requested label get_slice_bound(label, side, kind) Calculate slice bound that corresponds to given label. get_value(series, key) Fast lookup of value from 1-dimensional ndarray. get_value_maybe_box(series, key) get_values() return the underlying data as an ndarray groupby(f) holds_integer() identical(other) Similar to equals, but check that other comparable attributes are insert(loc, item) Make new Index inserting new item at location intersection(other) Specialized intersection for TimedeltaIndex objects. is_(other) More flexible, faster check like is but that works through views is_boolean() is_floating() is_integer() is_lexsorted_for_tuple(tup) is_mixed() is_numeric() is_object() is_type_compatible(typ) isin(values) Compute boolean array of whether each index value is found in the item() return the first element of the underlying data as a python scalar join(other[, how, level, return_indexers]) See Index.join map(f) max([axis]) return the maximum value of the Index min([axis]) return the minimum value of the Index nunique([dropna]) Return number of unique elements in the object. order([return_indexer, ascending]) Return sorted copy of Index putmask(mask, value) return a new Index of the values set with the mask ravel([order]) return an ndarray of the flattened values of the underlying data reindex(target[, method, level, limit]) Create index with target’s values (move/add/delete values as necessary) rename(name[, inplace]) Set new names on index. repeat(repeats[, axis]) Analogous to ndarray.repeat searchsorted(key[, side]) set_names(names[, level, inplace]) Set new names on index. set_value(arr, key, value) Fast lookup of value from 1-dimensional ndarray. shift(n[, freq]) Specialized shift which produces a DatetimeIndex slice_indexer([start, end, step, kind]) For an ordered Index, compute the slice indexer for input labels and slice_locs([start, end, step, kind]) Compute slice locations for input labels. sort(*args, **kwargs) summary([name]) return a summarized representation sym_diff(other[, result_name]) Compute the sorted symmetric difference of two Index objects. take(indices[, axis]) Analogous to ndarray.take to_datetime([dayfirst]) For an Index containing strings or datetime.datetime objects, attempt to_native_types([slicer]) slice and dice then format to_pytimedelta() Return TimedeltaIndex as object ndarray of datetime.timedelta objects to_series(**kwargs) Create a Series with both index and values equal to the index keys tolist() return a list of the underlying data transpose() return the transpose, which is by definition self union(other) Specialized union for TimedeltaIndex objects. unique() Index.unique with handling for DatetimeIndex/PeriodIndex metadata value_counts([normalize, sort, ascending, ...]) Returns object containing counts of unique values. view([cls])