From 8e8b98229734fd6d96958b07bb543f4118e573e1 Mon Sep 17 00:00:00 2001 From: Rupeshii Date: Fri, 28 Dec 2018 15:34:43 +0000 Subject: [PATCH 1/4] Done --- q02_plot_matches_by_team/build.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/q02_plot_matches_by_team/build.py b/q02_plot_matches_by_team/build.py index ce53182..a85b604 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,21 @@ # Solution +def plot_matches_by_team(): + team_details = ipl_df.groupby(['batting_team','match_code']).count() + teams_per_match = team_details.index.values + teams_details = [] + + for x in range(0,len(teams_per_match)): + teams_details.append(teams_per_match[x][0]) + + values, counts = np.unique(teams_details, return_counts=True) + x1_series = list(values) + y1_series = list(counts) + plt.bar(x1_series,y1_series) + plt.xticks(x1_series , rotation = 90) + plt.xlabel('batting_team') + plt.ylabel('delivery') + plt.show() + + From fa71e0c8fd2d10b3fddc7d246f4c9fb4bb214669 Mon Sep 17 00:00:00 2001 From: Rupeshii Date: Fri, 28 Dec 2018 15:36:45 +0000 Subject: [PATCH 2/4] Done --- q01_plot_deliveries_by_team/build.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/q01_plot_deliveries_by_team/build.py b/q01_plot_deliveries_by_team/build.py index d1dab11..64b7903 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,17 @@ # Solution + +def plot_deliveries_by_team(): + all_teams = ipl_df['batting_team'] + x_series = pd.Series(all_teams.value_counts().index) + y_series = pd.Series(all_teams.value_counts().values) + + plt.bar(x_series,y_series) + plt.xticks(rotation = 45) + plt.title('graph') + plt.xlabel('batting_team') + plt.ylabel('delivery') + plt.show() + + From 49a759e3cca6250da2b8d708f9233a65c451b528 Mon Sep 17 00:00:00 2001 From: Rupeshii Date: Sat, 29 Dec 2018 15:03:43 +0000 Subject: [PATCH 3/4] Done --- q03_plot_innings_runs_histogram/build.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/q03_plot_innings_runs_histogram/build.py b/q03_plot_innings_runs_histogram/build.py index ce53182..230efc1 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,18 @@ # Solution +def plot_innings_runs_histogram(): + inningwise_data = ipl_df.groupby(['inning','match_code']).sum() + inningwise_data.sort_index(inplace=True) + + match_codes = list(inningwise_data.loc[(1.0),'runs'].index.values) + first_innings_scores = list(inningwise_data.loc[(1.0),'runs']) + second_innings_scores = list(inningwise_data.loc[(2.0),'runs']) + + fig,axes = plt.subplots(1,2) + + axes[0].hist(first_innings_scores , bins = 5) + + axes[1].hist(second_innings_scores , bins = 5) + + From 1f1bfb4c0a5bfb2ea19e074737014e48c18523a8 Mon Sep 17 00:00:00 2001 From: Rupeshii Date: Sat, 29 Dec 2018 15:06:55 +0000 Subject: [PATCH 4/4] Done --- q04_plot_runs_by_balls/build.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/q04_plot_runs_by_balls/build.py b/q04_plot_runs_by_balls/build.py index ce53182..9caacf8 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,8 @@ # Solution +def plot_runs_by_balls(): + return None + + +