pandas.Index.names#

property Index.names[source]#

Get names on index.

This method returns a FrozenList containing the names of the object. It’s primarily intended for internal use.

Returns:
FrozenList

A FrozenList containing the object’s names, contains None if the object does not have a name.

See also

Index.name

Index name as a string, or None for MultiIndex.

Examples

>>> idx = pd.Index([1, 2, 3], name="x")
>>> idx.names
FrozenList(['x'])
>>> idx = pd.Index([1, 2, 3], name=("x", "y"))
>>> idx.names
FrozenList([('x', 'y')])

If the index does not have a name set:

>>> idx = pd.Index([1, 2, 3])
>>> idx.names
FrozenList([None])