Important links:
This is the starter notebook for the course project for Data Analysis with Python: Zero to Pandas. You will pick a real-world dataset of your choice and apply the concepts learned in this course to perform exploratory data analysis. Use this starter notebook as an outline for your project . Focus on documentation and presentation - this Jupyter notebook will also serve as a project report, so make sure to include detailed explanations wherever possible using Markdown cells.
Your submission will be evaluated using the following criteria:
Follow this step-by-step guide to work on your project.
opendatasets
Python libraryHere's some sample code for downloading the US Elections Dataset:
import opendatasets as od
dataset_url = 'https://www.kaggle.com/tunguz/us-elections-dataset'
od.download('https://www.kaggle.com/tunguz/us-elections-dataset')
You can find a list of recommended datasets here: https://jovian.ml/forum/t/recommended-datasets-for-course-project/11711
jovian.commit
.Refer to these projects for inspiration:
Analyzing your browser history using Pandas & Seaborn by Kartik Godawat
WhatsApp Chat Data Analysis by Prajwal Prashanth
Understanding the Gender Divide in Data Science Roles by Aakanksha N S
NOTE: Remove this cell containing the instructions before making your submission. You can do using the "Edit > Delete Cells" menu option.
TODO - Write some introduction about your project here: describe the dataset, where you got it from, what you're trying to do with it, and which tools & techniques you're using. You can also mention about the course Data Analysis with Python: Zero to Pandas, and what you've learned from it.
This is an executable Jupyter notebook hosted on Jovian.ml, a platform for sharing data science projects. You can run and experiment with the code in a couple of ways: using free online resources (recommended) or on your own computer.
The easiest way to start executing this notebook is to click the "Run" button at the top of this page, and select "Run on Binder". This will run the notebook on mybinder.org, a free online service for running Jupyter notebooks. You can also select "Run on Colab" or "Run on Kaggle".
Install Conda by following these instructions. Add Conda binaries to your system PATH
, so you can use the conda
command on your terminal.
Create a Conda environment and install the required libraries by running these commands on the terminal:
conda create -n zerotopandas -y python=3.8
conda activate zerotopandas
pip install jovian jupyter numpy pandas matplotlib seaborn opendatasets --upgrade
jovian clone notebook-owner/notebook-id
cd directory-name
and start the Jupyter notebook.jupyter notebook
You can now access Jupyter's web interface by clicking the link that shows up on the terminal or by visiting http://localhost:8888 on your browser. Click on the notebook file (it has a .ipynb
extension) to open it.
TODO - add some explanation here
Instructions for downloading the dataset (delete this cell)
- Find an interesting dataset on this page: https://www.kaggle.com/datasets?fileType=csv
- The data should be in CSV format, and should contain at least 3 columns and 150 rows
- Download the dataset using the
opendatasets
Python library
!pip install jovian opendatasets --upgrade --quiet
Let's begin by downloading the data, and listing the files within the dataset.
# Change this
dataset_url = 'https://www.kaggle.com/rishidamarla/video-game-sales'
import opendatasets as od
od.download(dataset_url)
Please provide your Kaggle credentials to download this dataset. Learn more: http://bit.ly/kaggle-creds
Your Kaggle username: akariiiii
Your Kaggle Key: ········
100%|██████████| 476k/476k [00:00<00:00, 85.7MB/s]
Downloading video-game-sales.zip to ./video-game-sales
The dataset has been downloaded and extracted.
# Change this
data_dir = './video-game-sales'
import os
os.listdir(data_dir)
['Video_Games.csv']
Let us save and upload our work to Jovian before continuing.
project_name = "data-analysis-of-video-game-sales" # change this (use lowercase letters and hyphens only)
!pip install jovian --upgrade -q
import jovian
jovian.commit(project=project_name)
[jovian] Attempting to save notebook..
[jovian] Please enter your API key ( from https://jovian.ml/ ):
API KEY: ········
[jovian] Updating notebook "indexkyou/data-analysis-of-video-game-sales" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/indexkyou/data-analysis-of-video-game-sales
TODO - Write some explanation here.
Instructions (delete this cell):
- Load the dataset into a data frame using Pandas
- Explore the number of rows & columns, ranges of values etc.
- Handle missing, incorrect and invalid data
- Perform any additional steps (parsing dates, creating additional columns, merging multiple dataset etc.)
import pandas as pd
game_sales_df = pd.read_csv('./video-game-sales/Video_Games.csv')
game_sales_df
game_sales_df.columns
Index(['Name', 'Platform', 'Year_of_Release', 'Genre', 'Publisher', 'NA_Sales',
'EU_Sales', 'JP_Sales', 'Other_Sales', 'Global_Sales', 'Critic_Score',
'Critic_Count', 'User_Score', 'User_Count', 'Developer', 'Rating'],
dtype='object')
game_sales_df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 16719 entries, 0 to 16718
Data columns (total 16 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Name 16717 non-null object
1 Platform 16719 non-null object
2 Year_of_Release 16450 non-null float64
3 Genre 16717 non-null object
4 Publisher 16665 non-null object
5 NA_Sales 16719 non-null float64
6 EU_Sales 16719 non-null float64
7 JP_Sales 16719 non-null float64
8 Other_Sales 16719 non-null float64
9 Global_Sales 16719 non-null float64
10 Critic_Score 8137 non-null float64
11 Critic_Count 8137 non-null float64
12 User_Score 10015 non-null object
13 User_Count 7590 non-null float64
14 Developer 10096 non-null object
15 Rating 9950 non-null object
dtypes: float64(9), object(7)
memory usage: 2.0+ MB
Look at the info we can see that not every game is rating and get critic score. We should take a closer look at the description.
game_sales_df.describe()
So we have around 16450 game titles that was sold between 1980 and 2020. NA seems like the biggest market to sell game.
import jovian
jovian.commit()
[jovian] Attempting to save notebook..
At first look the dataframe is already sorted by Global_Sales. But for better viewer we should try creating a few graph.
Instructions (delete this cell)
- Compute the mean, sum, range and other interesting statistics for numeric columns
- Explore distributions of numeric columns using histograms etc.
- Explore relationship between columns using scatter plots, bar charts etc.
- Make a note of interesting insights from the exploratory analysis
Let's begin by importingmatplotlib.pyplot
and seaborn
.
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
sns.set_style('darkgrid')
matplotlib.rcParams['font.size'] = 13
matplotlib.rcParams['figure.figsize'] = (36, 20)
matplotlib.rcParams['figure.facecolor'] = '#00000000'
First, We should see the total sales of games each year. It helps us know when video game is declined and when is it popular.
sns.countplot('Year_of_Release', data = game_sales_df)
plt.title('Total game sale each year')
plt.show()
So in 2008 and 2009 video game is really popular. Let see which game is the best seller in 2008 and 2009
list_games_2008 = game_sales_df.loc[game_sales_df['Year_of_Release'] == 2008]
list_games_2008.sort_values('Global_Sales',ascending = False).head(10)
list_games_2009 = game_sales_df.loc[game_sales_df['Year_of_Release'] == 2009]
list_games_2009.sort_values('Global_Sales',ascending = False).head(10)
In 2008 and 2009, the most popular game is from Wii platform. That's pretty interesting let see the devide graph for platform (We should combine two dataframe as well)
combine_list = list_games_2008.append(list_games_2009)
platform_counts = combine_list.Platform.value_counts()
plt.figure(figsize=(24,12))
plt.pie(platform_counts, labels=platform_counts.index, autopct='%1.1f%%', startangle=180);
Overall DS and Wii did the best in these year. Nitendo was really good back in time. We should properly check how Nintendo is doing up until now.
nitendo_df = game_sales_df.loc[game_sales_df['Publisher'] == 'Nintendo']
nitendo_df = nitendo_df.groupby('Year_of_Release').count()
nitendo_df = nitendo_df['Global_Sales']
plt.title("Nintendo sales")
sns.barplot(nitendo_df.index, nitendo_df);
sns.catplot(x = "Year_of_Release", y = "Global_Sales", kind = "point",
data = publisher_df,
hue = "Publisher",
ci = None,
edgecolor=None,
height=10,
aspect=36/12)
plt.show()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-43-df44de01ffa1> in <module>
----> 1 sns.catplot(x = "Year_of_Release", y = "Global_Sales", kind = "point",
2 data = publisher_df,
3 ci = None,
4 edgecolor=None,
5 height=10,
/srv/conda/envs/notebook/lib/python3.8/site-packages/seaborn/categorical.py in catplot(x, y, hue, data, row, col, col_wrap, estimator, ci, n_boot, units, seed, order, hue_order, row_order, col_order, kind, height, aspect, orient, color, palette, legend, legend_out, sharex, sharey, margin_titles, facet_kws, **kwargs)
3721 # facets to ensure representation of all data in the final plot
3722 p = _CategoricalPlotter()
-> 3723 p.establish_variables(x_, y_, hue, data, orient, order, hue_order)
3724 order = p.group_names
3725 hue_order = p.hue_names
/srv/conda/envs/notebook/lib/python3.8/site-packages/seaborn/categorical.py in establish_variables(self, x, y, hue, data, orient, order, hue_order, units)
150 if isinstance(var, str):
151 err = "Could not interpret input '{}'".format(var)
--> 152 raise ValueError(err)
153
154 # Figure out the plotting orientation
ValueError: Could not interpret input 'Year_of_Release'
Ok this look a bit complicated let narrow down it to 2007 to 2016.
new_data = game_sales_df.loc[game_sales_df['Year_of_Release'] > 2007]
sns.catplot(x = "Year_of_Release", y = "Global_Sales", kind = "point",
data = new_data,
hue = "Platform",
palette='Set1',
ci = None,
edgecolor=None,
height=5,
aspect=36/12)
plt.show()
Look at the graph, we can see that sadly video game is declined.
TODO - Explore one or more columns by plotting a graph below, and add some explanation about it
Let us save and upload our work to Jovian before continuing
import jovian
jovian.commit()
[jovian] Attempting to save notebook..
[jovian] Updating notebook "indexkyou/data-analysis-of-video-game-sales" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/indexkyou/data-analysis-of-video-game-sales
TODO - write some explanation here.
Instructions (delete this cell)
- Ask at least 5 interesting questions about your dataset
- Answer the questions either by computing the results using Numpy/Pandas or by plotting graphs using Matplotlib/Seaborn
- Create new columns, merge multiple dataset and perform grouping/aggregation wherever necessary
- Wherever you're using a library function from Pandas/Numpy/Matplotlib etc. explain briefly what it does
Let us save and upload our work to Jovian before continuing.
import jovian
jovian.commit()
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/zerotopandas-course-project-starter" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/zerotopandas-course-project-starter
TODO - Write some explanation here: a summary of all the inferences drawn from the analysis, and any conclusions you may have drawn by answering various questions.
import jovian
jovian.commit()
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/zerotopandas-course-project-starter" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/zerotopandas-course-project-starter
TODO - Write some explanation here: ideas for future projects using this dataset, and links to resources you found useful.
Submission Instructions (delete this cell)
- Upload your notebook to your Jovian.ml profile using
jovian.commit
.- Make a submission here: https://jovian.ml/learn/data-analysis-with-python-zero-to-pandas/assignment/course-project
- Share your work on the forum: https://jovian.ml/forum/t/course-project-on-exploratory-data-analysis-discuss-and-share-your-work/11684
- Share your work on social media (Twitter, LinkedIn, Telegram etc.) and tag @JovianML
(Optional) Write a blog post
- A blog post is a great way to present and showcase your work.
- Sign up on Medium.com to write a blog post for your project.
- Copy over the explanations from your Jupyter notebook into your blog post, and embed code cells & outputs
- Check out the Jovian.ml Medium publication for inspiration: https://medium.com/jovianml
import jovian
jovian.commit()
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/zerotopandas-course-project-starter" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/zerotopandas-course-project-starter