From 12b4e6cbc7bc1f5772342170b05d5391c6d0412a Mon Sep 17 00:00:00 2001 From: akashhchatterjee Date: Fri, 19 Oct 2018 13:58:32 +0000 Subject: [PATCH 1/4] Done --- q01_plot_deliveries_by_team/build.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/q01_plot_deliveries_by_team/build.py b/q01_plot_deliveries_by_team/build.py index d1dab11..0a58135 100644 --- a/q01_plot_deliveries_by_team/build.py +++ b/q01_plot_deliveries_by_team/build.py @@ -1,3 +1,4 @@ +# %load q01_plot_deliveries_by_team/build.py import pandas as pd import numpy as np import matplotlib.pyplot as plt @@ -7,3 +8,13 @@ # Solution +def plot_deliveries_by_team(): + ipl_df1 = ipl_df[['batting_team','delivery']].groupby(['batting_team']).count() + plt.bar(ipl_df1.index, ipl_df1['delivery']) + plt.title('Deliveries Played') + plt.xlabel('Teams') + plt.ylabel('Deliveries') + plt.show() + +plot_deliveries_by_team() + From 963fc6ca5a3b0c0e0c6f9fa732258dfe3bd574e7 Mon Sep 17 00:00:00 2001 From: akashhchatterjee Date: Fri, 19 Oct 2018 14:06:01 +0000 Subject: [PATCH 2/4] Done --- q02_plot_matches_by_team/build.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/q02_plot_matches_by_team/build.py b/q02_plot_matches_by_team/build.py index ce53182..1c5f3af 100644 --- a/q02_plot_matches_by_team/build.py +++ b/q02_plot_matches_by_team/build.py @@ -1,3 +1,4 @@ +# %load q02_plot_matches_by_team/build.py import pandas as pd import numpy as np import matplotlib.pyplot as plt @@ -6,3 +7,13 @@ # Solution +def plot_matches_by_team(): + ipl_df1 = ipl_df[['batting_team','match_code']].groupby(['batting_team']).nunique() + plt.bar(ipl_df1.index, ipl_df1['match_code']) + plt.title('Matches Played') + plt.xlabel('Teams') + plt.ylabel('Match') + plt.show() + +plot_matches_by_team() + From 0883eee85f5124a7811e6951c952a37740231c71 Mon Sep 17 00:00:00 2001 From: akashhchatterjee Date: Fri, 19 Oct 2018 17:07:01 +0000 Subject: [PATCH 3/4] Done --- q03_plot_innings_runs_histogram/build.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/q03_plot_innings_runs_histogram/build.py b/q03_plot_innings_runs_histogram/build.py index ce53182..78f379a 100644 --- a/q03_plot_innings_runs_histogram/build.py +++ b/q03_plot_innings_runs_histogram/build.py @@ -1,3 +1,4 @@ +# %load q03_plot_innings_runs_histogram/build.py import pandas as pd import numpy as np import matplotlib.pyplot as plt @@ -6,3 +7,14 @@ # Solution +def plot_innings_runs_histogram(): + ipl_df1 = ipl_df[['match_code','inning','runs']].groupby(['match_code','inning']).sum() + fig, axes = plt.subplots(nrows=1, ncols=2) + plt.hist(ipl_df1['runs']) +# plt.title('Deliveries Played') +# plt.xlabel('Teams') +# plt.ylabel('Deliveries') + plt.show() + +plot_innings_runs_histogram() + From 355e2f115aff1cd9758e98c0dbc0713dab2bb6c2 Mon Sep 17 00:00:00 2001 From: akashhchatterjee Date: Fri, 19 Oct 2018 18:21:18 +0000 Subject: [PATCH 4/4] Done --- q04_plot_runs_by_balls/build.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/q04_plot_runs_by_balls/build.py b/q04_plot_runs_by_balls/build.py index ce53182..3afbb74 100644 --- a/q04_plot_runs_by_balls/build.py +++ b/q04_plot_runs_by_balls/build.py @@ -1,3 +1,4 @@ +# %load q04_plot_runs_by_balls/build.py import pandas as pd import numpy as np import matplotlib.pyplot as plt @@ -6,3 +7,12 @@ # Solution +def plot_runs_by_balls(): + ipl_df1 = ipl_df[['batsman','delivery']].groupby(['batsman']).count() + ipl_df2 = ipl_df[['batsman','runs']].groupby(['batsman']).sum() + ipl_data=ipl_df1.join(ipl_df2, how='inner') + plt.scatter(ipl_df1, ipl_df2) + plt.show() + +plot_runs_by_balls() +