Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data_na = games.query('year_of_release >= 2010').pivot_table(index = 'platform', values = 'na_sales', aggfunc = 'sum').reset_index()
- data_na_top5_platform = data_na.sort_values(by = 'na_sales', ascending = False).head()
- data_eu = games.query('year_of_release >= 2010').pivot_table(index = 'platform', values = 'eu_sales', aggfunc = 'sum').reset_index()
- data_eu_top5_platform = data_eu.sort_values(by = 'eu_sales', ascending = False).head()
- data_jp = games.query('year_of_release >= 2010').pivot_table(index = 'platform', values = 'jp_sales', aggfunc = 'sum').reset_index()
- data_jp_top5_platform = data_jp.sort_values(by = 'jp_sales', ascending = False).head()
- fig, (ax1, ax2, ax3) = plt.subplots(1,3, figsize=(15, 10))
- ax1.pie(data_na_top5_platform['na_sales'], labels=data_na_top5_platform['platform'], autopct='%.2f')
- ax1.set(ylabel='', title='Северная Америка')
- ax2.pie(data_eu_top5_platform['eu_sales'], labels=data_eu_top5_platform['platform'], autopct='%.2f')
- ax2.set(ylabel='', title='Европа')
- ax3.pie(data_jp_top5_platform['jp_sales'], labels=data_jp_top5_platform['platform'], autopct='%.2f')
- ax3.set(ylabel='', title='Япония')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement