Trying to convert the indices of one column, into their own columns.
From:
[country, series, year, value]
[USA, A, 1994, 700000]
[USA, B, 1994, 701231]
[UK, A, 1994, 600000]
[UK, B, 1994, 601231]
[China, A, 1994, 6512312]
[China, B, 1994, 6432112]
To:
[country, A, B, year]
[USA, 700000, 701231, 1994]
[UK, 600000, 601231, 1994]
[China, 6512312, 6432112, 1994]
Have tried stacking/unstacking, pivoting, melting, groupby, etc..
I am fairly certain that one of these methods is the key to reorganizing this, I just cant seem to get it right.
End goal is to make a 3d scatterplot wherein one axis is year, another is A and another is B; while country will be indicated by color
Update: Using Pivot, I am able to get the data to Look the right way, but the same issue arises when I try to plot it.
Because 'Year' and 'Country' are indexed, they cannot be identified as elements eligible for axes.
Expected 'A' or 'B' but got 'year'/'country'