Trying to rename a column in a Data frame. I used the same line to rename the column "frames"
I want to rename a column from a "0" to "Grad"
result = pd.concat([table2, tableg3], axis=1)
result.rename(columns = {"0" : "Grad"}, inplace = True)
result
This outputs
CodePudding user response:
You forgot to assign the result
result=result.rename…
Or use inplace=True
Common mistake with pandas.
CodePudding user response:
"0" - string
0 - var
You havce to use {0 : "Grad"}
result.rename(columns = {0 : "Grad"}, inplace = True)
CodePudding user response:
Have you tried {0 : "Grad"}? What is the output of result.columns?