From 8819c564046ae23c37237bdb9712392105316bfd Mon Sep 17 00:00:00 2001 From: rameshpedagani Date: Wed, 26 Sep 2018 06:26:16 +0000 Subject: [PATCH 1/4] Done --- q01_plot_deliveries_by_team/build.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/q01_plot_deliveries_by_team/build.py b/q01_plot_deliveries_by_team/build.py index d1dab11..2bfe77c 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,22 @@ # Solution + +def plot_deliveries_by_team(): + team_delivery_counts = ipl_df.groupby('batting_team').count() + row_count = team_delivery_counts.shape[0] + x_series = np.arange(0, row_count, 1) + plt.figure(figsize=(20,5)) + plt.bar(x_series, team_delivery_counts.delivery) + plt.xlabel('Batting Team') + plt.ylabel(' Deliveries') + plt.title('Deliveries by Team Plot') + plt.xticks(x_series, team_delivery_counts.index, rotation=45) + plt.show() + + +plot_deliveries_by_team() + + + + From af81bef678dace068259d21309db7af8a48afa66 Mon Sep 17 00:00:00 2001 From: rameshpedagani Date: Wed, 26 Sep 2018 06:30:08 +0000 Subject: [PATCH 2/4] Done --- q02_plot_matches_by_team/build.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/q02_plot_matches_by_team/build.py b/q02_plot_matches_by_team/build.py index ce53182..f8814c2 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,15 @@ # Solution +def plot_deliveries_by_team(): + ser = ipl_df.groupby(['batting_team']).count()['match_code'] + y_pos = np.arange(len(ser)) + plt.bar(y_pos, ser, align='center', alpha=0.5) + x_pos = ser.index + plt.xticks(y_pos, x_pos, rotation=90) + plt.ylabel('Deliveries') + plt.title('Teams Vs Deliveries') + plt.show() + + + From 40f7fcf32995ff05b5845bca0405b16683f93993 Mon Sep 17 00:00:00 2001 From: rameshpedagani Date: Wed, 26 Sep 2018 06:32:06 +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..0f44bac 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_deliveries_by_team(): + ser = ipl_df.groupby(['batting_team']).count()['match_code'] + y_pos = np.arange(len(ser)) + plt.bar(y_pos, ser, align='center', alpha=0.5) + x_pos = ser.index + plt.xticks(y_pos, x_pos, rotation=90) + plt.ylabel('Deliveries') + plt.title('Teams Vs Deliveries') + plt.show() + + From 85672bb4c027fe2afde4abd65d2f5e9e84889531 Mon Sep 17 00:00:00 2001 From: rameshpedagani Date: Wed, 26 Sep 2018 06:34:09 +0000 Subject: [PATCH 4/4] Done --- q04_plot_runs_by_balls/build.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/q04_plot_runs_by_balls/build.py b/q04_plot_runs_by_balls/build.py index ce53182..52e24e7 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,14 @@ # Solution +def plot_deliveries_by_team(): + ser = ipl_df.groupby(['batting_team']).count()['match_code'] + y_pos = np.arange(len(ser)) + plt.bar(y_pos, ser, align='center', alpha=0.5) + x_pos = ser.index + plt.xticks(y_pos, x_pos, rotation=90) + plt.ylabel('Deliveries') + plt.title('Teams Vs Deliveries') + plt.show() + +