xarray.CFTimeIndex¶
-
class
xarray.
CFTimeIndex
(data, name=None)¶ Custom Index for working with CF calendars and dates
All elements of a CFTimeIndex must be cftime.datetime objects.
- Parameters
data (array or CFTimeIndex) – Sequence of cftime.datetime objects to use in index
name (str, default None) – Name of the resulting index
See also
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
()Initialize self.
all
(*args, **kwargs)Return whether all elements are True.
any
(*args, **kwargs)Return whether any element is True.
append
(other)Append a collection of Index options together.
argmax
([axis, skipna])Return an ndarray of the maximum argument indexer.
argmin
([axis, skipna])Return a ndarray of the minimum argument indexer.
argsort
(*args, **kwargs)Return the integer indices that would sort the index.
asof
(label)Return the label from the index, or, if not present, the previous one.
asof_locs
(where, mask)Find the locations (indices) of the labels from the index for every entry in the where argument.
astype
(dtype[, copy])Create an Index with values cast to dtypes.
ceil
(freq)Round dates up to fixed frequency.
contains
(key)Needed for .loc based partial-string indexing
copy
([name, deep, dtype])Make a copy of this object.
delete
(loc)Make new Index with passed location(-s) deleted.
difference
(other[, sort])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
([keep])Return Index with duplicate values removed.
droplevel
([level])Return index with requested level(s) removed.
dropna
([how])Return Index without NA/NaN values.
duplicated
([keep])Indicate duplicate index values.
equals
(other)Determine 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)Round dates down to fixed frequency.
format
([name, formatter])Render a string representation of the Index.
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)Compute indexer and mask for new index given the current index.
get_level_values
(level)Return an Index of values for requested level.
get_loc
(key[, method, tolerance])Adapted from pandas.tseries.index.DatetimeIndex.get_loc
get_slice_bound
(label, side, kind)Calculate slice bound that corresponds to given label.
get_value
(series, key)Adapted from pandas.tseries.index.DatetimeIndex.get_value
groupby
(values)Group the index labels by a given array of values.
Whether the type is an integer type.
identical
(other)Similar to equals, but check that other comparable attributes are also equal.
insert
(loc, item)Make new Index inserting new item at location.
intersection
(other[, sort])Form the intersection of two Index objects.
is_
(other)More flexible, faster check like
is
but that works through views.Check if the Index holds categorical data.
is_mixed
()is_type_compatible
(kind)Whether the index type is compatible with the provided type.
isin
(values[, level])Return a boolean array where the index values are in values.
isna
()Detect missing values.
isnull
()Detect missing values.
item
()Return the first element of the underlying data as a python scalar.
join
(other[, how, level, return_indexers, sort])Compute join_index and indexers to conform data structures to the new index.
map
(mapper[, na_action])Map values using input correspondence (a dict, Series, or function).
max
([axis, skipna])Return the maximum value of the Index.
memory_usage
([deep])Memory usage of the values.
min
([axis, skipna])Return the minimum value of the Index.
notna
()Detect existing (non-missing) values.
notnull
()Detect existing (non-missing) values.
nunique
([dropna])Return number of unique elements in the object.
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])Alter Index or MultiIndex name.
repeat
(repeats[, axis])Repeat elements of a Index.
round
(freq)Round dates to a fixed frequency.
searchsorted
(value[, side, sorter])Find indices where elements should be inserted to maintain order.
set_names
(names[, level, inplace])Set Index or MultiIndex name.
set_value
(arr, key, value)Fast lookup of value from 1-dimensional ndarray.
shift
(n, freq)Shift the CFTimeIndex a multiple of the given frequency.
slice_indexer
([start, end, step, kind])For an ordered or unique index, compute the slice indexer for input labels and step.
slice_locs
([start, end, step, kind])Compute slice locations for input labels.
sort
(*args, **kwargs)Use sort_values instead.
sort_values
([return_indexer, ascending])Return a sorted copy of the index.
sortlevel
([level, ascending, sort_remaining])For internal compatibility with with the Index API.
strftime
(date_format)Return an Index of formatted strings specified by date_format, which supports the same string format as the python standard library.
symmetric_difference
(other[, result_name, sort])Compute the symmetric difference of two Index objects.
take
(indices[, axis, allow_fill, fill_value])Return a new Index of the values selected by the indices.
to_datetimeindex
([unsafe])If possible, convert this index to a pandas.DatetimeIndex.
Identity method.
to_frame
([index, name])Create a DataFrame with a column containing the Index.
to_list
()Return a list of the values.
to_native_types
([slicer])Format specified values of self and return them.
to_numpy
([dtype, copy, na_value])A NumPy ndarray representing the values in this Series or Index.
to_series
([index, name])Create a Series with both index and values equal to the index keys.
tolist
()Return a list of the values.
transpose
(*args, **kwargs)Return the transpose, which is by definition self.
union
(other[, sort])Form the union of two Index objects.
unique
([level])Return unique values in the index.
value_counts
([normalize, sort, ascending, …])Return a Series containing counts of unique values.
view
([cls])where
(cond[, other])Return an Index of same shape as self and whose corresponding entries are from self where cond is True and otherwise are from other.
Attributes
Return the transpose, which is by definition self.
The ExtensionArray of the data backing this Series or Index.
Convert to integers with units of microseconds since 1970-01-01.
The days of the datetime
The day of week of the datetime
The ordinal day of year of the datetime
days_in_month
The number of days in the month of the datetime
Return the dtype object of the underlying data.
Return if I have any nans; enables various perf speedups.
The hours of the datetime
Return a string of the type inferred from the values.
Alias for is_monotonic_increasing.
Return if the index is monotonic decreasing (only equal or decreasing) values.
Return if the index is monotonic increasing (only equal or increasing) values.
Return if the index has unique values.
The microseconds of the datetime
The minutes of the datetime
The month of the datetime
Return the number of bytes in the underlying data.
Number of dimensions of the underlying data, by definition 1.
Number of levels.
The seconds of the datetime
Return a tuple of the shape of the underlying data.
Return the number of elements in the underlying data.
Return an array representing the data in the Index.
The year of the datetime