0

I have a dataframe that I'd like to replace column names with based on a dictionary mapping

df = 
     A_  B_  C29  D_9
0    01  01  01   01
1    02  01  01   01 
2    03  01  01   01 
3    04  01  01   01

dict = 
    A_ : A
    B_ : B
    C29 : C
    D_9 : D

I've tried using replace and rename which haven't worked

df= df.rename(columns = dict)
df= df.replace(dict)
Ch3steR
  • 20,090
  • 4
  • 28
  • 58
Squidf20
  • 23
  • 2

0 Answers0