I have pandas dataframe which has the same column names. (column names are a,b,a,a,a) Below is example.
Is there any way I can change column name only for 3rd column from the left by specifying column location? I found that there is a way to change column name by making a new list. But I wanted to see if there is any way I can specify column location and change the name.
Below is what I want.
Since I am new to programming, I would appreciate any of your help!
Does this work?:
column_names = df.columns.values
column_names[2] = 'Changed'
df.columns = column_names
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With