From ae43ae19d3c37ca6a03b9ec912b3051ac7d17581 Mon Sep 17 00:00:00 2001 From: paragDC Date: Fri, 28 Dec 2018 08:47:18 +0000 Subject: [PATCH 1/4] Done --- q01_plot_deliveries_by_team/build.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/q01_plot_deliveries_by_team/build.py b/q01_plot_deliveries_by_team/build.py index d1dab11..28b2b3d 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,16 @@ # 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 985d3231849e33beb327f868a90293df472a9549 Mon Sep 17 00:00:00 2001 From: paragDC Date: Sun, 30 Dec 2018 07:40:16 +0000 Subject: [PATCH 2/4] Done --- q01_plot_deliveries_by_team/build.py | 2 +- q02_plot_matches_by_team/build.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/q01_plot_deliveries_by_team/build.py b/q01_plot_deliveries_by_team/build.py index 28b2b3d..c54e6d5 100644 --- a/q01_plot_deliveries_by_team/build.py +++ b/q01_plot_deliveries_by_team/build.py @@ -8,6 +8,7 @@ # Solution + def plot_deliveries_by_team(): all_teams = ipl_df['batting_team'] x_series = pd.Series(all_teams.value_counts().index) @@ -20,4 +21,3 @@ def plot_deliveries_by_team(): plt.ylabel('delivery') plt.show() - 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 9dfa8740264a2a19ee72a38a23b11701292e7ccd Mon Sep 17 00:00:00 2001 From: paragDC Date: Sun, 30 Dec 2018 07:43:18 +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..c421349 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 32773a20c9b03b4c7818c7cc3a9fde4db0098ef0 Mon Sep 17 00:00:00 2001 From: paragDC Date: Sun, 30 Dec 2018 07:47:24 +0000 Subject: [PATCH 4/4] Done --- q04_plot_runs_by_balls/build.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/q04_plot_runs_by_balls/build.py b/q04_plot_runs_by_balls/build.py index ce53182..a68238b 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,11 @@ # Solution +def plot_runs_by_balls(): + return None +def plot_runs_by_balls(): + return None + + + +