0

I have a dataframe with column names being same:

id id
1   1
2   2
3   3

I want to change it to:

start end
1      1
2      2
3      3

I tried this:

df.rename(columns={df.columns[0]: 'start', df.columns[1]: 'end'})

But this changed both column names to 'end'.

How to fix that?

marlon
  • 6,029
  • 8
  • 42
  • 76

0 Answers0