Renaming columns in Pandas DataFrame

The Python Pandas module is a high performance, highly reliable, and high level data analytical library. The primary object in Pandas is called a DataFrame . The data in the DataFrame columns can contain alphanumerical characters or logical data and can be of the same type. Renaming DataFrame column headers is quite useful when you load a grid of data that has no column headers or if you want to assign different column headers to specific columns .


The DataFrame.rename shows that it accepts a dict as a parameter for columns headers, so you just pass a dict with a single entry.


Create a Pandas DataFrame with data

Reanme DataFrame column headers


In the above output rename column header Name to Students_name and Promoted to IsPromoted.

Property Description
old_name Old column header.
new_name Newly assinged column header.
axis=1 It's a column-wise operation.
inplace=True The data is renamed in place, returns None. (C) 2022    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About