The project aim is to analysing top Video Games Sales in Europe, North America, and Japan and also to see top publishers in that countries using Python
Step: 1
First, we will import the necessary libraries then we import the datasets
import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from scipy import stats
Video_Games_sales = pd.read_csv("Video_Games_sales.csv") Video_Games_sales
Step: 2
Now we will see in which countries the video games sales most
Country_List = ['NA_Sales', 'EU_Sales', 'JP_Sales', 'Other_Sales'] labels = Country_List plt.figure(figsize=(10,10)) sizes = Video_Games_sales[Country_List].sum() plt.pie(sizes, labels=labels, autopct='%1.1f%%',shadow=True, startangle=90) plt.show()
Here we see North America is at the top with 49.3% sales
Step: 3
Now we will see top Games and top publishers in North America
#North America top games Top = Video_Games_sales.groupby(by=['Name'])['NA_Sales'].sum() Top = Top.sort_values(ascending = False).nlargest(10) plt.figure(figsize=(10,10)) labels = Top.index sizes = Top explode = (0, 0.1, 0.1, 0.1, 0, 0, 0, 0, 0, 0) colors = ['darkred', 'maroon', 'firebrick', 'indianred', 'white', 'whitesmoke', 'lightsteelblue', 'cornflowerblue', 'royalblue', 'navy'] plt.pie(sizes, explode = explode, labels=labels, colors = colors, autopct='%1.1f%%', shadow=True, startangle=90) plt.show()
#North America Top publiser Top = Video_Games_sales.groupby(by=['Publisher'])['NA_Sales'].sum() Top = Top.sort_values(ascending = False).nlargest(10) plt.figure(figsize=(8,8)) labels = Top.index sizes = Top explode = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0) colors = ['indianred', 'firebrick', 'maroon', 'darkred', 'white', 'whitesmoke', 'navy', 'royalblue', 'cornflowerblue', 'lightsteelblue'] colors.reverse() plt.pie(sizes, explode = explode, labels=labels, colors = colors, autopct='%1.1f%%', shadow=True, startangle=90) plt.show()
Step: 4
Now we will see top Games and top publishers in Europe
#Europe top games Top = Video_Games_sales.groupby(by=['Name'])['EU_Sales'].sum() Top = top.sort_values(ascending = False).nlargest(10) plt.figure(figsize=(10,10)) labels = Top.index sizes = Top explode = (0, 0, 0, 0.1, 0, 0.1, 0.1, 0, 0, 0) colors = ['blue', 'mediumblue', 'royalblue','cornflowerblue', 'lightsteelblue','honeydew','lightgoldenrodyellow','lightyellow','yellow','gold'] plt.pie(sizes, explode = explode, labels=labels, colors = colors, autopct='%1.1f%%', shadow=True, startangle=90) plt.show()
#Europe top game publiser Top = Video_Games_sales.groupby(by=['Publisher'])['EU_Sales'].sum() Top = Top.sort_values(ascending = False).nlargest(10) plt.figure(figsize=(10,10)) labels = Top.index sizes = Top explode = (0, 0.1, 0, 0, 0, 0, 0, 0, 0, 0) colors = ['blue', 'mediumblue', 'royalblue','cornflowerblue', 'lightsteelblue','honeydew','lightgoldenrodyellow','lightyellow','yellow','gold'] colors.reverse() plt.pie(sizes, explode = explode, labels=labels, colors = colors, autopct='%1.1f%%', shadow=True, startangle=90) plt.show()
Step: 5
Now we will see top Games and top publishers in Japan
# Japan top Games Top = Video_Games_sales.groupby(by=['Name'])['JP_Sales'].sum() Top = Top.sort_values(ascending = False).nlargest(10) plt.figure(figsize=(10,10)) labels = Top.index sizes = Top explode = (0.1, 0.1, 0, 0, 0.1, 0, 0.1, 0, 0.1, 0) colors = ['darkred','maroon','firebrick','brown','indianred','lightcoral','peachpuff','seashell','oldlace','whitesmoke'] plt.pie(sizes, explode = explode, labels=labels, colors = colors, autopct='%1.1f%%', shadow=True, startangle=90) plt.show()
#top japan games publiser Top = Video_Games_sales.groupby(by=['Publisher'])['JP_Sales'].sum() Top = Top.sort_values(ascending = False).nlargest(10) plt.figure(figsize=(10,10)) labels = Top.index sizes = Top explode = (0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0) colors = ['darkred','maroon','firebrick','brown','indianred','lightcoral','peachpuff','seashell','oldlace','whitesmoke'] plt.pie(sizes, explode = explode, labels=labels, colors = colors, autopct='%1.1f%%', shadow=True, startangle=90) plt.show()
Submitted by Sudipta Ghosh (Sudipta609)
Download packets of source code on Coders Packet
Comments