Advertisement
DrunkMik

Untitled

Feb 20th, 2020
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. data_na = games.query('year_of_release >= 2010').pivot_table(index = 'platform', values = 'na_sales', aggfunc = 'sum').reset_index()
  2. data_na_top5_platform = data_na.sort_values(by = 'na_sales', ascending = False).head()
  3.  
  4. data_eu = games.query('year_of_release >= 2010').pivot_table(index = 'platform', values = 'eu_sales', aggfunc = 'sum').reset_index()
  5. data_eu_top5_platform = data_eu.sort_values(by = 'eu_sales', ascending = False).head()
  6.  
  7. data_jp = games.query('year_of_release >= 2010').pivot_table(index = 'platform', values = 'jp_sales', aggfunc = 'sum').reset_index()
  8. data_jp_top5_platform = data_jp.sort_values(by = 'jp_sales', ascending = False).head()
  9.  
  10. fig, (ax1, ax2, ax3) = plt.subplots(1,3, figsize=(15, 10))
  11.  
  12. ax1.pie(data_na_top5_platform['na_sales'], labels=data_na_top5_platform['platform'], autopct='%.2f')
  13. ax1.set(ylabel='', title='Северная Америка')
  14. ax2.pie(data_eu_top5_platform['eu_sales'], labels=data_eu_top5_platform['platform'], autopct='%.2f')
  15. ax2.set(ylabel='', title='Европа')
  16. ax3.pie(data_jp_top5_platform['jp_sales'], labels=data_jp_top5_platform['platform'], autopct='%.2f')
  17. ax3.set(ylabel='', title='Япония')
  18.  
  19. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement