pandas.Index.rename

pandas 3.1.1 · Index objects · method

Set the name of an Index or the names of a MultiIndex.

Call syntax

Index.rename(name, *, inplace=False)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
name Required
Positional or keyword
Hashable or a sequence of the previous

Set a name or identify the named object used by the operation.

inplace Optional
Keyword only
Default False
bool

Choose whether to change the existing object. Where supported, an in-place call typically returns None.

Returns

Index or None