Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename a pandas Series?

Tags:

python

pandas

How can I change the name of a Series object?

like image 765
tagoma Avatar asked Aug 31 '13 22:08

tagoma


People also ask

How do I rename my pandas series?

rename() function is used to alter Series index labels or name for the given Series object. inplace : Whether to return a new Series. If True then value of copy is ignored.

How do you rename a column in series?

You can use the rename() method of pandas. DataFrame to change column/index name individually. Specify the original name and the new name in dict like {original name: new name} to columns / index parameter of rename() .

Can you name a column in a pandas series?

The name of a Series becomes its index or column name if it is used to form a DataFrame. It is also used whenever displaying the Series using the interpreter.


1 Answers

Not sure why no one mentioned rename

s.rename("new_name", inplace=True)
like image 164
Biarys Avatar answered Oct 08 '22 04:10

Biarys