I have a pandas dataframe like this:
After I transpose it, it becomes this:
What I want is to rename 'Country Name' to 'Years' and use it as an index column, and names of the countries as separate columns and use those columns as values for the bar plot. This, I believe, is a prerequisite for making animated bar plots using bar_chart_race. But renaming the column using pd.rename does not work. I am also confused whether transposing the dataframe was the best move here. I don't quite understand how pd.melt() or pd. pivot() will help me. Any suggestions would be appreciated.