What would be the process for getting this data organized so the years would be listed along the left, the country names along the top, and the values filling out the table?
Asked
Active
Viewed 17 times
0
-
1[Please don't post images of code/data (or links to them)](http://meta.stackoverflow.com/questions/285551/why-may-i-not-upload-images-of-code-on-so-when-asking-a-question) , also Please take the time to read this post on [how to provide a great pandas example](http://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – anky Jan 03 '20 at 17:28
-
3Does this answer your question? [How to pivot a dataframe](https://stackoverflow.com/questions/47152691/how-to-pivot-a-dataframe) – G. Anderson Jan 03 '20 at 17:28
-
look into `pd.crosstab` or `pd.pivot` or `pd.groupby` + `unstack` : `pd.crosstab(df['Year'], df['Country Name'], df['Values'], aggfunc='sum')` – Umar.H Jan 03 '20 at 17:32
-
`pd.pivot_table(df, values = 'Value', index='Year', columns = 'Country Name')` – d_kennetz Jan 03 '20 at 17:42