🔵 🔵 🔵


Primary

၊၊||၊|။

pandas.Index() ⚬|Documentation|1st|20251021014631-00-⌔

pandas.Index — pandas 2.3.3 documentation#pandas.Index

class pandas.Index(data=None, dtype=None, copy=None, name=None, tupleize_cols=True)

Immutable sequence used for indexing and alignment.

The basic object storing axis labels for all pandas objects.

Changed in version 2.0.0: Index can hold all numpy numeric dtypes (except float16). Previously only int64/uint64/float64 dtypes were accepted.

Parameters:
data: array-like (1-dimensional)

An array-like structure containing the data for the index. This could be a Python list, a NumPy array, or a pandas Series.

dtype: str, numpy.dtype, or ExtensionDtype, optional

Data type for the output Index. If not specified, this will be inferred from data. See the user guide for more usages.

copy: bool, default None

Whether to copy input data, only relevant for array, Series, and Index inputs (for other input, e.g. a list, a new array is created anyway). Defaults to True for array input and False for Index/Series. Set to False to avoid copying array input at your own risk (if you know the input data won’t be modified elsewhere). Set to True to force copying Series/Index input up front.

name: object

Name to be stored in the index.

tupleize_cols: bool (default: True)

When True, attempt to create a MultiIndex if possible.

See also:
RangeIndex

Index implementing a monotonic integer range.

CategoricalIndex

Index of Categorical s.

MultiIndex

A multi-level, or hierarchical Index.

IntervalIndex

An Index of Interval s.

DatetimeIndex

Index of datetime64 data.

TimedeltaIndex

Index of timedelta64 data.

PeriodIndex

Index of Period data.

Notes:

An Index instance can only contain hashable objects. An Index instance can not hold numpy float16 dtype.

Examples:
>>> pd.Index([1, 2, 3])
Index([1, 2, 3], dtype='int64')
>>> pd.Index(list("abc"))
Index(['a', 'b', 'c'], dtype='str')
>>> pd.Index([1, 2, 3], dtype="uint8")
Index([1, 2, 3], dtype='uint8')
Attributes:

📊 ➺

Methods:

📊 ➺

Printed 2026-06-28.

(echo:: @ )

Link to original

Secondary

• • •