!pip install jovian --upgrade --quiet
!pip install pandas --upgrade
Requirement already up-to-date: pandas in /srv/conda/envs/notebook/lib/python3.7/site-packages (1.1.2)
Requirement already satisfied, skipping upgrade: pytz>=2017.2 in /srv/conda/envs/notebook/lib/python3.7/site-packages (from pandas) (2020.1)
Requirement already satisfied, skipping upgrade: python-dateutil>=2.7.3 in /srv/conda/envs/notebook/lib/python3.7/site-packages (from pandas) (2.8.1)
Requirement already satisfied, skipping upgrade: numpy>=1.15.4 in /srv/conda/envs/notebook/lib/python3.7/site-packages (from pandas) (1.19.2)
Requirement already satisfied, skipping upgrade: six>=1.5 in /srv/conda/envs/notebook/lib/python3.7/site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)
import pandas as pd
matches_raw_df = pd.read_csv('matches.csv')
matches_raw_df
matches_raw_df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 756 entries, 0 to 755
Data columns (total 18 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 id 756 non-null int64
1 season 756 non-null int64
2 city 749 non-null object
3 date 756 non-null object
4 team1 756 non-null object
5 team2 756 non-null object
6 toss_winner 756 non-null object
7 toss_decision 756 non-null object
8 result 756 non-null object
9 dl_applied 756 non-null int64
10 winner 752 non-null object
11 win_by_runs 756 non-null int64
12 win_by_wickets 756 non-null int64
13 player_of_match 752 non-null object
14 venue 756 non-null object
15 umpire1 754 non-null object
16 umpire2 754 non-null object
17 umpire3 119 non-null object
dtypes: int64(5), object(13)
memory usage: 106.4+ KB
import jovian
jovian.commit(files = ['matches.csv'])
[jovian] Attempting to save notebook..
matches_raw_df.groupby('season').season.count()
season
2008 58
2009 57
2010 60
2011 73
2012 74
2013 76
2014 60
2015 59
2016 60
2017 59
2018 60
2019 60
Name: season, dtype: int64
matches_raw_df.groupby('season').toss_decision.value_counts() / matches_raw_df.groupby('season').season.count()
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-83ad5ba3f4d1> in <module>
----> 1 matches_raw_df.groupby('season').toss_decision.value_counts() / matches_raw_df.groupby('season').season.count()
NameError: name 'matches_raw_df' is not defined
(matches_raw_df.team2.value_counts() + matches_raw_df.team1.value_counts())
matches_raw_df.winner.value_counts() / (matches_raw_df.team2.value_counts() + matches_raw_df.team1.value_counts())
Chennai Super Kings 0.609756
Deccan Chargers 0.386667
Delhi Capitals 0.625000
Delhi Daredevils 0.416149
Gujarat Lions 0.433333
Kings XI Punjab 0.465909
Kochi Tuskers Kerala 0.428571
Kolkata Knight Riders 0.516854
Mumbai Indians 0.582888
Pune Warriors 0.260870
Rajasthan Royals 0.510204
Rising Pune Supergiant 0.625000
Rising Pune Supergiants 0.357143
Royal Challengers Bangalore 0.466667
Sunrisers Hyderabad 0.537037
dtype: float64
jovian.commit()
[jovian] Attempting to save notebook..
[jovian] Updating notebook "srijansrj5901/ipl-data-anaysis-78bb0" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/srijansrj5901/ipl-data-anaysis-78bb0
jovian.commit(files = ['matches.csv'])
[jovian] Attempting to save notebook..
[jovian] Updating notebook "srijansrj5901/ipl-matches-data-analysis" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Uploading additional files...
[jovian] Committed successfully! https://jovian.ml/srijansrj5901/ipl-matches-data-analysis