The column names of my dataframe looks like:
Country Code 1900.0 1901.0 1902.0 1903.0 1904.0......
Now I would like to change the numbers from float type to string, so I use:
df.columns[2:] = [str(int(x)) for x in df.columns[2:]]
but it shows error:
TypeError: Index does not support mutable operations
I know I can use dict to change column names, but what if there are too many names having to be changed?