I have a df X with columns with duplicate names:
In [77]: X_R
Out[77]:
dollars dollars
0 0.7085 0.5000
I want to rename it so that I have:
In [77]: X_R
Out[77]:
Retail Cost
0 0.7085 0.5000
Using the Pandas rename function does' work:
X_R.rename(index=str, columns={"dollars": "Retail", "dollars": "Cost"})
Just gives me two columns named Cost.
How can I rename the columns in this case?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…