In [339]:
# Erik Rodriguez Video Games Data Analysis and Visualizations, Github Project Notebook and Dataset available https://github.com/AirTechWick/video-games-sales-analysis
In [37]:
import matplotlib.pyplot as plt
import pandas as pd
In [39]:
# Read Data using pandas
vg_sales = pd.read_csv("vgsales_top300.csv")
In [41]:
vg_sales
Out[41]:
Rank | Name | Platform | Year | Genre | Publisher | NA_Sales | EU_Sales | JP_Sales | Other_Sales | Global_Sales | |
---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | Wii Sports | Wii | 2006 | Sports | Nintendo | 41.49 | 29.02 | 3.77 | 8.46 | 82.74 |
1 | 2 | Super Mario Bros. | NES | 1985 | Platform | Nintendo | 29.08 | 3.58 | 6.81 | 0.77 | 40.24 |
2 | 3 | Mario Kart Wii | Wii | 2008 | Racing | Nintendo | 15.85 | 12.88 | 3.79 | 3.31 | 35.82 |
3 | 4 | Wii Sports Resort | Wii | 2009 | Sports | Nintendo | 15.75 | 11.01 | 3.28 | 2.96 | 33.00 |
4 | 5 | Pokemon Red/Pokemon Blue | GB | 1996 | Role-Playing | Nintendo | 11.27 | 8.89 | 10.22 | 1.00 | 31.37 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
295 | 296 | Far Cry 4 | PS4 | 2014 | Shooter | Ubisoft | 1.12 | 2.12 | 0.10 | 0.69 | 4.03 |
296 | 297 | Star Fox 64 | N64 | 1997 | Shooter | Nintendo | 2.78 | 0.58 | 0.64 | 0.04 | 4.03 |
297 | 298 | Minecraft | PS4 | 2014 | Misc | Sony Computer Entertainment Europe | 1.38 | 1.87 | 0.12 | 0.65 | 4.02 |
298 | 299 | Golf | NES | 1984 | Sports | Nintendo | 1.22 | 0.28 | 2.46 | 0.04 | 4.01 |
299 | 300 | Fallout 3 | PS3 | 2008 | Role-Playing | Bethesda Softworks | 2.15 | 1.20 | 0.07 | 0.59 | 4.01 |
300 rows × 11 columns
In [132]:
# Want to see video game sales of GameBoy GB only
gb_games_filter = vg_sales[vg_sales["Platform"] == "GB"]
# Using the Names of the games as the x labels
categories_x = gb_games_filter["Name"]
# Want to see NA sales as the Y axis values
values_y = gb_games_filter["NA_Sales"]
# Sorting the NA sales from Most sold to Least sold
sort_values_y = gb_games_filter["NA_Sales"].sort_values(ascending=False)
In [142]:
gb_games_filter
Out[142]:
Rank | Name | Platform | Year | Genre | Publisher | NA_Sales | EU_Sales | JP_Sales | Other_Sales | Global_Sales | |
---|---|---|---|---|---|---|---|---|---|---|---|
4 | 5 | Pokemon Red/Pokemon Blue | GB | 1996 | Role-Playing | Nintendo | 11.27 | 8.89 | 10.22 | 1.00 | 31.37 |
5 | 6 | Tetris | GB | 1989 | Puzzle | Nintendo | 23.20 | 2.26 | 4.22 | 0.58 | 30.26 |
12 | 13 | Pokemon Gold/Pokemon Silver | GB | 1999 | Role-Playing | Nintendo | 9.00 | 6.18 | 7.20 | 0.71 | 23.10 |
21 | 22 | Super Mario Land | GB | 1989 | Platform | Nintendo | 10.83 | 2.71 | 4.18 | 0.42 | 18.14 |
30 | 31 | Pokémon Yellow: Special Pikachu Edition | GB | 1998 | Role-Playing | Nintendo | 5.89 | 5.04 | 3.12 | 0.59 | 14.64 |
50 | 51 | Super Mario Land 2: 6 Golden Coins | GB | 1992 | Adventure | Nintendo | 6.16 | 2.04 | 2.69 | 0.29 | 11.18 |
132 | 133 | Pokémon Crystal Version | GB | 2000 | Role-Playing | Nintendo | 2.55 | 1.56 | 1.29 | 0.99 | 6.39 |
170 | 171 | Dr. Mario | GB | 1989 | Puzzle | Nintendo | 2.18 | 0.96 | 2.00 | 0.20 | 5.34 |
171 | 172 | Pokemon Pinball | GB | 1999 | Misc | Nintendo | 3.02 | 1.12 | 1.01 | 0.16 | 5.31 |
184 | 185 | Super Mario Land 3: Wario Land | GB | 1994 | Platform | Nintendo | 2.49 | 0.98 | 1.57 | 0.15 | 5.19 |
191 | 192 | Kirby's Dream Land | GB | 1992 | Platform | Nintendo | 2.71 | 0.61 | 1.70 | 0.11 | 5.13 |
200 | 201 | Super Mario Bros. | GB | 1999 | Platform | Nintendo | 3.40 | 1.30 | 0.15 | 0.22 | 5.07 |
In [126]:
sort_values_y
Out[126]:
5 23.20 4 11.27 21 10.83 12 9.00 50 6.16 30 5.89 200 3.40 171 3.02 191 2.71 132 2.55 184 2.49 170 2.18 Name: NA_Sales, dtype: float64
Bar Chart of Top selling Game Boy Games¶
In [291]:
# matplotlib to plot bar graph
plt.bar(categories_x, sort_values_y)
# setting font size
plt.rcParams['font.size'] = 8
# limiting display of x axis
plt.xlim(0,3)
Out[291]:
(0.0, 3.0)
Frequency of Genre in all GBA games¶
In [314]:
# How frequent each genre is in gba games
freq_genre = plt.hist(gb_games_filter["Genre"])
In [316]:
x_hist_genre = gb_games_filter["Genre"]
In [318]:
from collections import Counter
Most popular genres in GB games¶
In [299]:
genre_counts = Counter(x_hist_genre)
plt.pie(genre_counts.values(), labels=genre_counts.keys())
Out[299]:
([<matplotlib.patches.Wedge at 0x28a025bbef0>, <matplotlib.patches.Wedge at 0x28a02669040>, <matplotlib.patches.Wedge at 0x28a0268e4e0>, <matplotlib.patches.Wedge at 0x28a02668650>, <matplotlib.patches.Wedge at 0x28a0268e900>], [Text(0.5499999702695115, 0.9526279613277875, 'Role-Playing'), Text(-0.9526279870751434, 0.5499999256737774, 'Puzzle'), Text(-0.5499998810780428, -0.9526280128224968, 'Platform'), Text(0.7778175867481129, -0.777817331862271, 'Adventure'), Text(1.0625184600079092, -0.2847007589424754, 'Misc')])
NA Sales of games through years¶
In [328]:
x_inputs = range(1990,2002)
plt.plot(x_inputs, gb_games_filter["NA_Sales"])
Out[328]:
[<matplotlib.lines.Line2D at 0x28a02459e20>]
Sales Compared to Eachother¶
In [303]:
x_inputs = range(1990,2002)
na_sales = gb_games_filter["NA_Sales"]
eu_sales = gb_games_filter["EU_Sales"]
jp_sales = gb_games_filter["JP_Sales"]
plt.fill_between(x_inputs, na_sales, label="NA Sales")
plt.fill_between(x_inputs, eu_sales + na_sales, na_sales, label="EU Sales")
plt.fill_between(x_inputs, na_sales + eu_sales + jp_sales, na_sales + eu_sales, label="JP Sales")
plt.legend()
Out[303]:
<matplotlib.legend.Legend at 0x28a0258ac30>
Games Sold in EU¶
In [337]:
plt.scatter(vg_sales["Year"],vg_sales["EU_Sales"])
Out[337]:
<matplotlib.collections.PathCollection at 0x28a026ffaa0>