From eadec1bbc96e7be25d7cf3f22a7ead6e56dd062e Mon Sep 17 00:00:00 2001 From: Abhimanyu22 Date: Thu, 18 Oct 2018 09:35:01 +0000 Subject: [PATCH 1/4] Done --- q01_plot_deliveries_by_team/build.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/q01_plot_deliveries_by_team/build.py b/q01_plot_deliveries_by_team/build.py index d1dab11..3a86448 100644 --- a/q01_plot_deliveries_by_team/build.py +++ b/q01_plot_deliveries_by_team/build.py @@ -5,5 +5,15 @@ ipl_df = pd.read_csv('data/ipl_dataset.csv', index_col=None) +def plot_deliveries_by_team(): + count_deliveries = ipl_df.groupby(['batting_team']).agg('count')['delivery'] + count_deliveries.plot(kind = 'bar') + + plt.show(); + + + +plot_deliveries_by_team() + + -# Solution From 13ca3bf8f7aa77b5ab104c20909b1257afb63d1c Mon Sep 17 00:00:00 2001 From: Abhimanyu22 Date: Thu, 18 Oct 2018 09:45:22 +0000 Subject: [PATCH 2/4] Done --- q02_plot_matches_by_team/build.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/q02_plot_matches_by_team/build.py b/q02_plot_matches_by_team/build.py index ce53182..f8cbe24 100644 --- a/q02_plot_matches_by_team/build.py +++ b/q02_plot_matches_by_team/build.py @@ -4,5 +4,13 @@ plt.switch_backend('agg') ipl_df = pd.read_csv('data/ipl_dataset.csv', index_col=None) +def plot_matches_by_team(): + count_matches = ipl_df.groupby(['batting_team']).agg('nunique')['match_code'] + count_matches.plot(kind = 'bar') + plt.show(); + +plot_matches_by_team() + + + -# Solution From 9ceb277359ec0ebdea290fc4c3c9e979a379b593 Mon Sep 17 00:00:00 2001 From: Abhimanyu22 Date: Thu, 18 Oct 2018 10:13:42 +0000 Subject: [PATCH 3/4] Done --- q03_plot_innings_runs_histogram/build.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/q03_plot_innings_runs_histogram/build.py b/q03_plot_innings_runs_histogram/build.py index ce53182..baa1b4c 100644 --- a/q03_plot_innings_runs_histogram/build.py +++ b/q03_plot_innings_runs_histogram/build.py @@ -4,5 +4,11 @@ plt.switch_backend('agg') ipl_df = pd.read_csv('data/ipl_dataset.csv', index_col=None) +def plot_innings_runs_histogram(): + f1_match = ipl_df.groupby(['match_code','inning']).agg('sum')['total'] + f1_match.plot(kind= 'hist', subplots= True) + plt.show(); + +plot_innings_runs_histogram() + -# Solution From dfc32c59a9c063f858ca94d82f7c64cb7dafeb41 Mon Sep 17 00:00:00 2001 From: Abhimanyu22 Date: Thu, 18 Oct 2018 10:58:44 +0000 Subject: [PATCH 4/4] Done --- q04_plot_runs_by_balls/build.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/q04_plot_runs_by_balls/build.py b/q04_plot_runs_by_balls/build.py index ce53182..3289bb2 100644 --- a/q04_plot_runs_by_balls/build.py +++ b/q04_plot_runs_by_balls/build.py @@ -4,5 +4,16 @@ plt.switch_backend('agg') ipl_df = pd.read_csv('data/ipl_dataset.csv', index_col=None) +def plot_runs_by_balls(): + runs_scored = pd.DataFrame(ipl_df.groupby(['match_code', 'batsman']).agg('sum')['runs']) + balls_played = pd.DataFrame(ipl_df.groupby(['match_code', 'batsman']).agg('count')['delivery']) + playedscored = runs_scored.join(balls_played) + plt.scatter(playedscored['runs'], playedscored['delivery']) + plt.show(); + + + +plot_runs_by_balls() + + -# Solution