cudf.Index.get_level_values#

Index.get_level_values(level)#

Return an Index of values for requested level.

This is primarily useful to get an individual level of values from a MultiIndex, but is provided on Index as well for compatibility.

Parameters
levelint or str

It is either the integer position or the name of the level.

Returns
Index

Calling object, as there is only one level in the Index.

See also

cudf.MultiIndex.get_level_values

Get values for a level of a MultiIndex.

Notes

For Index, level should be 0, since there are no multiple levels.

Examples

>>> import cudf
>>> idx = cudf.Index(["a", "b", "c"])
>>> idx.get_level_values(0)
StringIndex(['a' 'b' 'c'], dtype='object')