0

I am trying to rename a header in excel file using Python.

import pandas as pd

file1='emp_list.xlsx'
df1=pd.read_excel(file1)

df_rename=df1.rename(columns={'Employee':'Emp_Name'},inplace=True)
print(df_rename)

Above code is returning none. Can anyone help me?

  • remove ```inplace=True``` if you are assigning back the operation to a new dataframe, or alternatively remove ```df_rename=``` – sophocles Oct 08 '21 at 10:20

0 Answers0