I have DataFrame like below:
df - pd.DataFrame({"col1" : (1 ,2 ,3),
"col1" : (2,3,4),
"col2" : (10, 11, 12)})
And then I make: df.columns.tolist()
and I have list of columns of df:
("col1",
"col1",
"col2)
And how can I change the name of the second “col1” to for example “col3” ? because as I means if I will try: df.rename(columns={"col1" : "col3"}, inplace=True)
the first “col1” will be changed.