Renaming column in pandas

Betaspyder
Jul 30, 2022

--

In this article, |I will be showing you how to rename the column name in pandas. It’s a small article. It’s going to have only one concept.

I have used Jupyter Notebook for writing code and I have taken Data Scientist salary Dataset from Kaggle.

First import the dataset and print the five rows from the dataset.

import pandas

Next, display the columns name by using columns attribute.

Displaying Columns

Now, we are going to rename the column Unnamed: 0 as Serial_no

Renamed as Serial_no

If you want to rename multiple columns, you can do like below

renaming multiple columns

Hope you all loved this tutorial. If you like this article, please give a clap. Happy Coding…!!!

if you want full coding, click this link. Follow me on GitHub and Twitter

--

--

Betaspyder

Technical Writer, Content Creator, Content Writer, Python, Data Analyst, Database, HTML, Javascript