xarray.CFTimeIndex#
- class xarray.CFTimeIndex(data, name=None, **kwargs)[source]#
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
See also
- __init__()#
Methods
__init__
()all
(*args, **kwargs)Return whether all elements are Truthy.
any
(*args, **kwargs)Return whether any element is Truthy.
append
(other)Append a collection of Index options together.
argmax
([axis, skipna])Return int position of the largest value in the Series.
argmin
([axis, skipna])Return int position of the smallest value in the Series.
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)Return the locations (indices) of labels in the index.
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])Make a copy of this object.
delete
(loc)Make new Index with passed location(-s) deleted.
diff
([periods])Computes the difference between consecutive values in the Index object.
difference
(other[, sort])Return a new Index with elements of index 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 object are equal.
factorize
([sort, use_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, na_rep])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)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)Adapted from pandas.tseries.index.DatetimeIndex.get_loc
get_slice_bound
(label, side)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 checks that object attributes and types are also equal.
infer_objects
([copy])If we have an object dtype, try to infer a non-object dtype.
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 only consists of booleans.
Check if the Index holds categorical data.
Check if the Index is a floating type.
Check if the Index only consists of integers.
Check if the Index holds Interval objects.
Check if the Index only consists of numeric data.
Check if the Index is of the object dtype.
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, ...])Compute join_index and indexers to conform data structures to the new index.
map
(mapper[, na_action])Map values using an input mapping 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 a view on self.
reindex
(target[, method, level, limit, ...])Create index with target's values.
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.
shift
(periods[, freq])Shift the CFTimeIndex a multiple of the given frequency.
slice_indexer
([start, end, step])Compute the slice indexer for input labels and step.
slice_locs
([start, end, step])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, ...])For internal compatibility 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_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])Replace values where the condition is False.
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 calendar used by the datetimes in the index.
The days of the datetime
The day of week of the datetime
The ordinal day of year of the datetime
The number of days in the month of the datetime
Return the dtype object of the underlying data.
The frequency used by the dates in the index.
Check if the Index has duplicate values.
Return True if there are any NaNs.
The hours of the datetime
Return a string of the type inferred from the values.
is_leap_year
Return a boolean if the values are equal or decreasing.
Return a boolean if the values are equal or increasing.
Return if the index has unique values.
The microseconds of the datetime
The minutes of the datetime
The month of the datetime
Return Index or MultiIndex name.
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