From afd955f6b8ef4ad965cb860fb3bb776b58c0c095 Mon Sep 17 00:00:00 2001 From: sach07 Date: Sun, 21 Oct 2018 16:22:13 +0000 Subject: [PATCH 1/4] Done --- q01_plot_deliveries_by_team/build.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/q01_plot_deliveries_by_team/build.py b/q01_plot_deliveries_by_team/build.py index d1dab11..060f485 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,10 @@ # Solution +def plot_deliveries_by_team(): + delieveries=ipl_df[['batting_team','delivery']].groupby('batting_team').count().sort_values(by='delivery',ascending=False) + delieveries.plot(kind='bar') + plt.show() + #r + + From 1395d4b00575660c9265893c09f8036421a38606 Mon Sep 17 00:00:00 2001 From: sach07 Date: Sun, 21 Oct 2018 16:43:19 +0000 Subject: [PATCH 2/4] Done --- q02_plot_matches_by_team/build.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/q02_plot_matches_by_team/build.py b/q02_plot_matches_by_team/build.py index ce53182..cba1be2 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,10 @@ # Solution +def plot_matches_by_team(): + match_count_per_teams=ipl_df[['batting_team','match_code']].groupby('batting_team').aggregate('nunique') + Series_of_matches=np.arange(len(match_count_per_teams.index)) + plt.bar('bbatting_team',match_count_per_teams['match_code']) +plot_matches_by_team() + + From 2e85f15975b56bd4a25d47aa557b3a214f17bce3 Mon Sep 17 00:00:00 2001 From: sach07 Date: Sun, 21 Oct 2018 19:13:54 +0000 Subject: [PATCH 3/4] Done --- q03_plot_innings_runs_histogram/build.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/q03_plot_innings_runs_histogram/build.py b/q03_plot_innings_runs_histogram/build.py index ce53182..e1b2582 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,19 @@ # Solution +def plot_innings_runs_histogram(): + group_innings = ipl_df.groupby(['match_code', 'inning']).sum().reset_index() + group_innings.head() + inning1_df = group_innings[group_innings['inning'] == 1] + inning2_df = group_innings[group_innings['inning'] == 2] + + + fig, axes = plt.subplots(1, 2) + + axes[0].hist(inning1_df['runs']) + axes[1].hist(inning2_df['runs']) + plt.show(); + +plot_innings_runs_histogram() + + From e9c5690c70b0ba4082b69eb2842c8cdb5e8854bb Mon Sep 17 00:00:00 2001 From: sach07 Date: Sun, 21 Oct 2018 19:28:56 +0000 Subject: [PATCH 4/4] Done --- q04_plot_runs_by_balls/build.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/q04_plot_runs_by_balls/build.py b/q04_plot_runs_by_balls/build.py index ce53182..b9370ab 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,10 @@ # Solution +def plot_runs_by_balls(): + runs_per_delivery=ipl_df[['runs','delivery']].groupby('delivery').sum() + plt.scatter(runs_per_delivery.index,runs_per_delivery['runs']) + plt.show() + + +