pandas.MultiIndex.names#

property MultiIndex.names[source]#

Names of levels in MultiIndex.

This attribute provides access to the names of the levels in a MultiIndex. The names are stored as a FrozenList, which is an immutable list-like container. Each name corresponds to a level in the MultiIndex, and can be used to identify or manipulate the levels individually.

See also

MultiIndex.set_names

Set Index or MultiIndex name.

MultiIndex.rename

Rename specific levels in a MultiIndex.

Index.names

Get names on index.

Examples

>>> mi = pd.MultiIndex.from_arrays(
...     [[1, 2], [3, 4], [5, 6]], names=['x', 'y', 'z']
... )
>>> mi
MultiIndex([(1, 3, 5),
            (2, 4, 6)],
           names=['x', 'y', 'z'])
>>> mi.names
FrozenList(['x', 'y', 'z'])