pandas.Series.rename
pandas 3.1.1 · Series and accessors · method
Change labels using a mapping or callable. A Series can also receive a new name.
Call syntax
Series.rename(index=None, *, axis=None, copy=…, inplace=…, level=None, errors='ignore')Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
index |
Optional Positional or keyword Default None |
scalar, hashable sequence, dict-like or function Supply row labels or control how existing row labels are used. |
axis |
Optional Keyword only Default None |
{0 or 'index'} Choose which axis the operation acts on. The accepted axis labels depend on the receiver. |
copy |
Optional Keyword only |
bool Control whether data is copied where the API supports that choice. |
inplace |
Optional Keyword only |
bool Choose whether to change the existing object. Where supported, an in-place call typically returns None. |
level |
Optional Keyword only Default None |
int or level name Choose an index level by name or integer position. |
errors |
Optional Keyword only Default 'ignore' |
{'ignore', 'raise'} Choose how to handle invalid input or failed operations. The available options depend on the API. |
Returns
Series