Indexing

Index

Index(data[, dtype, name])

Koalas Index that corresponds to pandas Index logically.

Properties

Index.is_monotonic

Return boolean if values in the object are monotonically increasing.

Index.is_monotonic_increasing

Return boolean if values in the object are monotonically increasing.

Index.is_monotonic_decreasing

Return boolean if values in the object are monotonically decreasing.

Index.has_duplicates

If index has duplicates, return True, otherwise False.

Index.hasnans

Return True if it has any missing values.

Index.dtype

Return the dtype object of the underlying data.

Index.is_all_dates

Return if all data types of the index are datetime.

Index.shape

Return a tuple of the shape of the underlying data.

Index.name

Return name of the Index.

Index.names

Return names of the Index.

Index.ndim

Return an int representing the number of array dimensions.

Index.size

Return an int representing the number of elements in this object.

Index.nlevels

Number of levels in Index & MultiIndex.

Index.empty

Returns true if the current object is empty.

Index.T

Return the transpose, For index, It will be index itself.

Index.values

Return an array representing the data in the Index.

Modifying and computations

Index.all([axis])

Return whether all elements are True.

Index.any([axis])

Return whether any element is True.

Index.argmin()

Return a minimum argument indexer.

Index.argmax()

Return a maximum argument indexer.

Index.copy([name, deep])

Make a copy of this object.

Index.delete(loc)

Make new Index with passed location(-s) deleted.

Index.equals(other)

Determine if two Index objects contain the same elements.

Index.identical(other)

Similar to equals, but check that other comparable attributes are also equal.

Index.is_boolean()

Return if the current index type is a boolean type.

Index.is_categorical()

Return if the current index type is a categorical type.

Index.is_floating()

Return if the current index type is a floating type.

Index.is_integer()

Return if the current index type is a integer type.

Index.is_interval()

Return if the current index type is an interval type.

Index.is_numeric()

Return if the current index type is a numeric type.

Index.is_object()

Return if the current index type is a object type.

Index.drop(labels)

Make new Index with passed list of labels deleted.

Index.drop_duplicates()

Return Index with duplicate values removed.

Index.min()

Return the minimum value of the Index.

Index.max()

Return the maximum value of the Index.

Index.rename(name[, inplace])

Alter Index or MultiIndex name.

Index.repeat(repeats)

Repeat elements of a Index/MultiIndex.

Index.take(indices)

Return the elements in the given positional indices along an axis.

Index.unique([level])

Return unique values in the index.

Index.nunique([dropna, approx, rsd])

Return number of unique elements in the object.

Index.value_counts([normalize, sort, …])

Return a Series containing counts of unique values.

Compatibility with MultiIndex

Index.set_names(names[, level, inplace])

Set Index or MultiIndex name.

Compatibility with MultiIndex

Index.droplevel(level)

Return index with requested level(s) removed.

Missing Values

Index.fillna(value)

Fill NA/NaN values with the specified value.

Index.dropna()

Return Index or MultiIndex without NA/NaN values

Index.isna()

Detect existing (non-missing) values.

Index.notna()

Detect existing (non-missing) values.

Conversion

Index.astype(dtype)

Cast a Koalas object to a specified dtype dtype.

Index.to_series([name])

Create a Series with both index and values equal to the index keys useful with map for returning an indexer based on an index.

Index.to_frame([index, name])

Create a DataFrame with a column containing the Index.

Index.to_numpy([dtype, copy])

A NumPy ndarray representing the values in this Index or MultiIndex.

MultiIndex

MultiIndex(kdf)

Koalas MultiIndex that corresponds to pandas MultiIndex logically.

MultiIndex Constructors

MultiIndex.from_arrays(arrays[, sortorder, …])

Convert arrays to MultiIndex.

MultiIndex.from_tuples(tuples[, sortorder, …])

Convert list of tuples to MultiIndex.

MultiIndex.from_product(iterables[, …])

Make a MultiIndex from the cartesian product of multiple iterables.

MultiIndex Properties

MultiIndex.has_duplicates

If index has duplicates, return True, otherwise False.

MultiIndex.hasnans

Return True if it has any missing values.

MultiIndex.is_all_dates

is_all_dates always returns False for MultiIndex

MultiIndex.shape

Return a tuple of the shape of the underlying data.

MultiIndex.names

Return names of the Index.

MultiIndex.ndim

Return an int representing the number of array dimensions.

MultiIndex.empty

Returns true if the current object is empty.

MultiIndex.T

Return the transpose, For index, It will be index itself.

MultiIndex.size

Return an int representing the number of elements in this object.

MultiIndex.nlevels

Number of levels in Index & MultiIndex.

MultiIndex.levshape

A tuple with the length of each level.

MultiIndex.values

Return an array representing the data in the Index.

MultiIndex components

MultiIndex.swaplevel([i, j])

Swap level i with level j.

MultiIndex components

MultiIndex.droplevel(level)

Return index with requested level(s) removed.

MultiIndex Missing Values

MultiIndex.fillna(value)

Fill NA/NaN values with the specified value.

MultiIndex.dropna()

Return Index or MultiIndex without NA/NaN values

MultiIndex Modifying and computations

MultiIndex.equals(other)

Determine if two Index objects contain the same elements.

MultiIndex.identical(other)

Similar to equals, but check that other comparable attributes are also equal.

MultiIndex.drop(codes[, level])

Make new MultiIndex with passed list of labels deleted

MultiIndex.copy([deep])

Make a copy of this object.

MultiIndex.delete(loc)

Make new Index with passed location(-s) deleted.

MultiIndex.rename(name[, inplace])

Alter Index or MultiIndex name.

MultiIndex.repeat(repeats)

Repeat elements of a Index/MultiIndex.

MultiIndex.take(indices)

Return the elements in the given positional indices along an axis.

MultiIndex.unique([level])

Return unique values in the index.

MultiIndex.min()

Return the minimum value of the Index.

MultiIndex.max()

Return the maximum value of the Index.

MultiIndex.value_counts([normalize, sort, …])

Return a Series containing counts of unique values.

MultiIndex Combining / joining / set operations

MultiIndex.append(other)

Append a collection of Index options together.

MultiIndex.union(other[, sort])

Form the union of two Index objects.

MultiIndex.difference(other[, sort])

Return a new Index with elements from the index that are not in other.

MultiIndex.symmetric_difference(other[, …])

Compute the symmetric difference of two MultiIndex objects.

MultiIndex Conversion

MultiIndex.astype(dtype)

Cast a Koalas object to a specified dtype dtype.

MultiIndex.to_series([name])

Create a Series with both index and values equal to the index keys useful with map for returning an indexer based on an index.

MultiIndex.to_frame([index, name])

Create a DataFrame with the levels of the MultiIndex as columns.

MultiIndex.to_numpy([dtype, copy])

A NumPy ndarray representing the values in this Index or MultiIndex.