Index objects#

Index#

Many of these methods or variants thereof are available on the objects that contain an index (Series/DataFrame) and those should most likely be used before calling these methods directly.

Index(*args, **kwargs)

Immutable sequence used for indexing and alignment.

Properties#

Index.values

Return an array representing the data in the Index.

Index.is_monotonic

Index.is_monotonic_increasing

Return a boolean if the values are equal or increasing.

Index.is_monotonic_decreasing

Return a boolean if the values are equal or decreasing.

Index.dtype

Return the dtype object of the underlying data.

Index.inferred_type

Return a string of the type inferred from the values.

Index.shape

Index.name

Return Index or MultiIndex name.

Index.names

Index.ndim

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

Index.size

Return the number of elements in the underlying data.

Index.T

Return the transpose, which is by definition self.

Index.memory_usage([deep])

Memory usage of the values.

Modifying and computations#

Index.all()

Return whether all elements are Truthy.

Index.any()

Return whether any element is Truthy.

Index.argmin([axis, skipna])

Return int position of the smallest value in the Series.

Index.argmax([axis, skipna])

Return int position of the largest value in the Series.

Index.copy([name, deep])

Make a copy of this object.

Index.delete(loc)

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

Index.drop(labels[, errors])

Make new Index with passed list of labels deleted.

Index.drop_duplicates([keep, method])

Return Index with duplicate values removed.

Index.duplicated([keep])

Indicate duplicate index values.

Index.equals(other)

Determine if two Index object are equal.

Index.factorize([sort, use_na_sentinel])

Encode the object as an enumerated type or categorical variable.

Index.identical(other)

Similar to equals, but checks that object attributes and types are also equal.

Index.insert(loc, item)

Make new Index inserting new item at location.

Index.is_(other)

More flexible, faster check like is but that works through views.

Index.is_boolean()

Check if the Index only consists of booleans.

Index.is_categorical()

Check if the Index holds categorical data.

Index.is_floating()

Check if the Index is a floating type.

Index.is_integer()

Check if the Index only consists of integers.

Index.is_interval()

Check if the Index holds Interval objects.

Index.is_numeric()

Check if the Index only consists of numeric data.

Index.is_object()

Check if the Index is of the object dtype.

Index.min([axis, skipna])

Return the minimum value of the Index.

Index.max([axis, skipna])

Return the maximum value of the Index.

Index.reindex(target[, method, level, ...])

Create index with target's values.

Index.rename(name[, inplace])

Alter Index or MultiIndex name.

Index.repeat(repeats[, axis])

Repeat elements of a Index.

Index.where(cond[, other])

Replace values where the condition is False.

Index.take(indices[, axis, allow_fill, ...])

Return a new Index of the values selected by the indices.

Index.putmask(mask, value)

Return a new Index of the values set with the mask.

Index.unique([level])

Return unique values in the index.

Index.nunique([dropna])

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.

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([how])

Return Index without NA/NaN values.

Index.isna()

Detect missing values.

Index.notna()

Detect existing (non-missing) values.

Conversion#

Index.astype(dtype[, copy])

Create an Index with values cast to dtypes.

Index.item()

Return the first element of the underlying data as a Python scalar.

Index.map(mapper[, na_action, dtype, ...])

Map values using an input mapping or function.

Index.ravel([order])

Return a view on self.

Index.to_list()

Return a list of the values.

Index.to_series([index, name])

Create a Series with both index and values equal to the index keys.

Index.to_frame([index, name])

Create a DataFrame with a column containing the Index.

Index.view([cls])

Sorting#

Index.argsort(*args, **kwargs)

Return the integer indices that would sort the index.

Index.searchsorted(value[, side, sorter])

Find indices where elements should be inserted to maintain order.

Index.sort_values([return_indexer, ...])

Return a sorted copy of the index.

Time-specific operations#

Index.shift([periods, freq])

Shift index by desired number of time frequency increments.

Combining / joining / set operations#

Index.append(other)

Append a collection of Index options together.

Index.join()

Compute join_index and indexers to conform data structures to the new index.

Index.intersection(other[, sort])

Form the intersection of two Index objects.

Index.union(other[, sort])

Form the union of two Index objects.

Index.difference(other[, sort])

Return a new Index with elements of index not in other.

Index.symmetric_difference(other[, ...])

Compute the symmetric difference of two Index objects.

Selecting#

Index.asof(label)

Return the label from the index, or, if not present, the previous one.

Index.asof_locs(where, mask)

Return the locations (indices) of labels in the index.

Index.get_indexer(target[, method, limit, ...])

Compute indexer and mask for new index given the current index.

Index.get_indexer_for(target)

Guaranteed return of an indexer even when non-unique.

Index.get_indexer_non_unique(target)

Compute indexer and mask for new index given the current index.

Index.get_level_values(level)

Return an Index of values for requested level.

Index.get_loc(key)

Get integer location, slice or boolean mask for requested label.

Index.get_slice_bound(label, side)

Calculate slice bound that corresponds to given label.

Index.isin(values[, level])

Return a boolean array where the index values are in values.

Index.slice_indexer([start, end, step])

Compute the slice indexer for input labels and step.

Index.slice_locs([start, end, step])

Compute slice locations for input labels.

Numeric Index#

CategoricalIndex#

Categorical components#

Modifying and computations#

IntervalIndex#

IntervalIndex components#

MultiIndex#

MultiIndex constructors#

MultiIndex properties#

MultiIndex components#

MultiIndex selecting#

DatetimeIndex#

Time/date components#

Selecting#

Time-specific operations#

Conversion#

Methods#

TimedeltaIndex#

Components#

Conversion#

Methods#

PeriodIndex#

Properties#

Methods#