pandas.TimedeltaIndex¶
-
class
pandas.
TimedeltaIndex
[source]¶ 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
Notes
To learn more about the frequency strings, please see this link.
Attributes
T
return the transpose, which is by definition self asi8
asobject
return object Index which contains boxed values base
return the base object if the memory of the underlying data is 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
dtype_str
flags
freq
freqstr
Return the frequency object as a string if its set, otherwise None has_duplicates
hasnans
inferred_freq
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 is_unique
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. name
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, nlevels
resolution
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 Methods
all
([other])any
([other])append
(other)Append a collection of Index options together argmax
([axis])Returns the indices of the maximum values along an axis. argmin
([axis])Returns the indices of the minimum values along an axis. argsort
(\*args, \*\*kwargs)Returns the indices that would sort the index and its 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])Create an Index with values cast to dtypes. ceil
(freq)ceil the index to the specified freq copy
([name, deep, dtype])Make a copy of this object. delete
(loc)Make a new DatetimeIndex with passed location(s) deleted. difference
(other)Return a new Index with elements from the index that are not in other. drop
(labels[, errors])Make new Index with passed list of labels deleted drop_duplicates
(\*args, \*\*kwargs)Return Index with duplicate values removed dropna
([how])Return Index without NA/NaN values duplicated
(\*args, \*\*kwargs)Return boolean np.ndarray 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 fillna
([value, downcast])Fill NA/NaN values with the specified value floor
(freq)floor the index to the specified freq format
([name, formatter])Render a string representation of the Index get_duplicates
()get_indexer
(target[, method, limit, tolerance])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, tolerance])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
(values)Group the index labels by a given array of values. 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 viewsis_boolean
()is_categorical
()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 join
(other[, how, level, return_indexers])See Index.join map
(f)max
([axis])Return the maximum value of the Index or maximum along an axis. memory_usage
([deep])Memory usage of my values min
([axis])Return the minimum value of the Index or minimum along an axis. 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, \*args, \*\*kwargs)Analogous to ndarray.repeat reshape
(\*args, \*\*kwargs)NOT IMPLEMENTED: do not call this method, as reshaping is not supported for Index objects and will raise an error. round
(freq, \*args, \*\*kwargs)round the index to the specified freq searchsorted
(key[, side, sorter])Find indices where elements should be inserted to maintain order. 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)sort_values
([return_indexer, ascending])Return sorted copy of Index sortlevel
([level, ascending, sort_remaining])For internal compatibility with with the Index API str
alias of StringMethods
summary
([name])return a summarized representation sym_diff
(\*args, \*\*kwargs)symmetric_difference
(other[, result_name])Compute the symmetric difference of two Index objects. take
(indices[, axis, allow_fill, fill_value])return a new %(klass)s of the values selected by the indices to_datetime
([dayfirst])DEPRECATED: use pandas.to_datetime()
instead.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 total_seconds
()Total duration of each element expressed in seconds. transpose
(\*args, \*\*kwargs)return the transpose, which is by definition self union
(other)Specialized union for TimedeltaIndex objects. unique
()Return Index of unique values in the object. value_counts
([normalize, sort, ascending, ...])Returns object containing counts of unique values. view
([cls])where
(cond[, other])New in version 0.19.0.