DEV Community

loading...

Renaming a Specific Column in Pandas

GharamElhendy
Aspiring data scientist. This is profile serves as a timeline/documentation of my learning process and progress.
・1 min read

Importing and Parsing

import pandas as pd
df = pd.read_csv('file_name.csv')
df.head()


Check the column's name you want to change, and then:

df.rename(columns={'old_name':'new_name'}, inplace=True)


Discussion (0)

Forem Open with the Forem app