cudf.Index#

class cudf.Index(data=None, dtype=None, copy=False, name=_NoDefault.no_default, 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, converts np.nan values to null values. If False, leaves np.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, subclass BaseIndex instead.

Examples

>>> import cudf
>>> cudf.Index([1, 2, 3], dtype="uint64", name="a")
UInt64Index([1, 2, 3], dtype='uint64', name='a')

Attributes

hasnans

Return True if there are any NaNs or nulls.

is_monotonic

Return boolean if values in the object are monotonic_increasing.

is_unique

Return if the index has unique values.

name

Returns the name of the Index.

names

Returns a tuple containing the name of the Index.

ndim

Number of dimensions of the underlying data, by definition 1.

nlevels

Number of levels.

shape

Get a tuple representing the dimensionality of the data.

str

Not yet implemented.

dtype

empty

has_duplicates

is_monotonic_decreasing

is_monotonic_increasing

size

values

Methods

any()

Return whether any elements is True in Index.

append(other)

Append a collection of Index objects together.

argsort(*args, **kwargs)

Return the integer indices that would sort the index.

astype(dtype[, copy])

Create an Index with values cast to dtypes.

deserialize(header, frames)

Generate an object from a serialized representation.

device_deserialize(header, frames)

Perform device-side deserialization tasks.

device_serialize()

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.

equals(other)

Determine if two Index objects contain the same elements.

fillna(value[, downcast])

Fill null values with the specified value.

find_label_range(loc)

Translate a label-based slice to an index-based slice

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.

host_serialize()

Serialize data and metadata associated with host memory.

intersection(other[, sort])

Form the intersection of two Index objects.

is_boolean()

Check if the Index only consists of booleans.

is_categorical()

Check if the Index holds categorical data.

is_floating()

Check if the Index is a floating type.

is_integer()

Check if the Index only consists of integers.

is_interval()

Check if the Index holds Interval objects.

is_numeric()

Check if the Index only consists of numeric data.

is_object()

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.

max()

The maximum value of the index.

memory_usage([deep])

Return the memory usage of an object.

min()

The minimum value of the index.

notna()

Detect existing (non-missing) values.

rename(name[, inplace])

Alter Index name.

repeat(repeats[, axis])

Repeat elements of a Index.

searchsorted(value[, side, ascending, ...])

Find index where elements should be inserted to maintain order

serialize()

Generate an equivalent serializable representation of an object.

set_names(names[, level, inplace])

Set Index or MultiIndex name.

shift([periods, freq])

Not yet implemented

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

to_arrow()

Convert to a suitable Arrow object.

to_cupy()

Convert to a cupy array.

to_dlpack()

Converts a cuDF object into a DLPack tensor.

to_frame([index, name])

Create a DataFrame with a column containing this Index

to_numpy()

Convert to a numpy array.

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.

where(cond[, other, inplace])

Replace values where the condition is False.

copy

factorize

from_arrow

get_loc

to_list

tolist