<jupyter_start><jupyter_text>Video Games Sales - <NAME> - March 26th, 2018<jupyter_code># global installs for needed packages
import numpy as np
import pandas as pd
from datetime import date
# read video games sales data
df = pd.read_csv('./vgsales.csv')
df.head()
df.info()
df.describe()
df.NA_Sales.std()
# if we wanted to change the year to an int
# df.Year = df.Year(lambda x: int(x))
# jk doesn't work<jupyter_output><empty_output><jupyter_text>Which company is the most common video game publisher?<jupyter_code>#scott
#df['Publisher'].groupby(df['Publisher']).count().sort_values(ascending=False).head(1)
df.Publisher.groupby(df.Publisher).count().sort_values(ascending=False).head(2) # can use dot notation unless column has space
# get column publisher
# group by and count collapses

df[df.Publisher == 'Electronic Arts'].head(5) #return all games where electronic arts is the publisher
#publisher = pd.DataFrame(df['Publisher']).groupby(df.Publisher).count()
publisher = pd.DataFrame(df.Publisher).groupby(df.Publisher).count()
publisher = publisher.sort_values(['Publisher'], ascending=False)
publisher.head()<jupyter_output><empty_output><jupyter_text>What is the most common platform?<jupyter_code>#scott
#df.Platform.groupby(df.Platform).count().sort_values(ascending=False).head()
platform = pd.DataFrame(df['Platform']).groupby(df.Platform).count()
platform = platform.sort_values(['Platform'], ascending=False)
platform.head()<jupyter_output><empty_output><jupyter_text>What is the most common genre?<jupyter_code>#scott
# df.Genre.groupby(df.Genre).count().sort_values(ascending=False).head()
#df.info() lets us know data type of values
#df.describe() lets you know mean, std, other info of each column
genre = pd.DataFrame(df['Genre']).groupby(df.Genre).count()
genre = genre.sort_values(['Genre'], ascending=False)
genre.head()<jupyter_output><empty_output><jupyter_text>What are the top 20 highest grossing games?<jupyter_code>gs = df.sort_values(['Global_Sales'], ascending=False)
gs.head(20)<jupyter_output><empty_output><jupyter_text>For North American video game sales, what’s the median?<jupyter_code>df.NA_Sales.median()
# med = pd.DataFrame(df['NA_Sales']).median()
# med<jupyter_output><empty_output><jupyter_text>Provide a secondary output showing 'about' ten games surrounding the median sales output<jupyter_code>df[(df['NA_Sales'] > 0.075) & (df['NA_Sales'] < 0.085)].head(11)<jupyter_output><empty_output><jupyter_text>For the top-selling game of all time, how many standard deviations above/below the mean are its sales for North America?<jupyter_code># (pd.DataFrame(df['NA_Sales']).max() - pd.DataFrame(df['NA_Sales']).mean()) / pd.DataFrame(df['NA_Sales']).std()
(df.NA_Sales.max() - df.NA_Sales.mean()) / df['NA_Sales'].std()<jupyter_output><empty_output><jupyter_text>The Nintendo Wii seems to have outdone itself with games. How does its average number of sales compare with all of the other platforms?<jupyter_code># from class
#df.Global_Sales.groupby(df.Platform).mean().sort_values(ascending=False)
pd.DataFrame(df[['Platform', 'Global_Sales']]).groupby(df.Platform).count().sort_values('Platform', ascending=False).head()<jupyter_output><empty_output><jupyter_text>What are the top ten highest grossing games in Europe?<jupyter_code>df[['Name', 'EU_Sales']].sort_values('EU_Sales', ascending=False).head(10)
## What are the top ten years with the hisest flobal sales?
df[['Year', 'Global_Sales']].head(11)
df.head(10)<jupyter_output><empty_output><jupyter_text>What are the top 10 grossing games in Japan?<jupyter_code>df[['Name', 'JP_Sales']].sort_values('JP_Sales', ascending =False).head(10)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1487333151729774, 'fraction_numerical': 0.008989376191773358, 'mean_word_length': 8.044334975369457, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '174998', 'license': 'MIT', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1229, 'n_words': 267, 'path': 'vg-stats.ipynb', 'repo_name': 'tyler-fishbone/data-science', 'size': '3679'}