cudf.Index#
- class cudf.Index(data=None, dtype=None, copy=False, name=None, tupleize_cols=True, nan_as_null=True, **kwargs)#
The basic object storing row labels for all cuDF objects.
- Parameters
- dataarray-like (1-dimensional)/ DataFrame
If it is a DataFrame, it will return a MultiIndex
- dtypeNumPy dtype (default: object)
If dtype is None, we find the dtype that best fits the data.
- copybool
Make a copy of input data.
- nameobject
Name to be stored in the index.
- tupleize_colsbool (default: True)
When True, attempt to create a MultiIndex if possible. tupleize_cols == False is not yet supported.
- nan_as_nullbool, Default True
If
None
/True
, convertsnp.nan
values tonull
values. IfFalse
, leavesnp.nan
values as is.
- Returns
- Index
cudf Index
Warning
This class should not be subclassed. It is designed as a factory for different subclasses of
BaseIndex
depending on the provided input. If you absolutely must, and if you’re intimately familiar with the internals of cuDF, subclassBaseIndex
instead.Examples
>>> import cudf >>> cudf.Index([1, 2, 3], dtype="uint64", name="a") UInt64Index([1, 2, 3], dtype='uint64', name='a')
>>> cudf.Index(cudf.DataFrame({"a":[1, 2], "b":[2, 3]})) MultiIndex([(1, 2), (2, 3)], names=['a', 'b'])
Attributes
Return True if there are any NaNs or nulls.
Return boolean if values in the object are monotonic_increasing.
Return boolean if values in the object are monotonically decreasing.
Return boolean if values in the object are monotonically increasing.
Returns a tuple containing the name of the Index.
Number of levels.
has_duplicates
size
values
Methods
any
()Return whether any elements is True in Index.
append
(other)Append a collection of Index objects together.
deserialize
(header, frames)Generate an object from a serialized representation.
device_deserialize
(header, frames)Perform device-side deserialization tasks.
Serialize data and metadata associated with device memory.
difference
(other[, sort])Return a new Index with elements from the index that are not in other.
drop_duplicates
([keep, nulls_are_equal])Drop duplicate rows in index.
dropna
([how])Drop null rows from Index.
duplicated
([keep])Indicate duplicate index values.
fillna
(value[, downcast])Fill null values with the specified value.
from_pandas
(index[, nan_as_null])Convert from a Pandas Index.
get_level_values
(level)Return an Index of values for requested level.
get_slice_bound
(label, side[, kind])Calculate slice bound that corresponds to given label.
host_deserialize
(header, frames)Perform device-side deserialization tasks.
Serialize data and metadata associated with host memory.
intersection
(other[, sort])Form the intersection of two Index objects.
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)Return a boolean array where the index values are in values.
isna
()Detect missing values.
join
(other[, how, level, return_indexers, sort])Compute join_index and indexers to conform data structures to the new index.
notna
()Detect existing (non-missing) values.
rename
(name[, inplace])Alter Index name.
repeat
(repeats[, axis])Repeat elements of a Index.
Generate an equivalent serializable representation of an object.
set_names
(names[, level, inplace])Set Index or MultiIndex name.
sort_values
([return_indexer, ascending, ...])Return a sorted copy of the index, and optionally return the indices that sorted the index itself.
take
(indices[, axis, allow_fill, fill_value])Return a new index containing the rows specified by indices
Converts a cuDF object into a DLPack tensor.
to_frame
([index, name])Create a DataFrame with a column containing this Index
to_pandas
([nullable])Convert to a Pandas Index.
to_series
([index, name])Create a Series with both index and values equal to the index keys.
union
(other[, sort])Form the union of two Index objects.
unique
()Return unique values in the index.
copy
from_arrow
get_loc