diff --git a/q01_plot_deliveries_by_team/build.py b/q01_plot_deliveries_by_team/build.py index d1dab11..32c3454 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,18 @@ # Solution +def plot_deliveries_by_team(): + + ipl_df = pd.DataFrame(ipl_df) + ipl_df['batting_team'].value_counts('delivery').plot(kind='bar') + plt.show() + + + + +# plt.xlabel('Batting team',size = 20) +# plt.ylabel('Delivery',size = 20) + + + + diff --git a/q02_plot_matches_by_team/build.py b/q02_plot_matches_by_team/build.py index ce53182..4213e4a 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,11 @@ # Solution +x = ipl_df['batting_team'].value_counts() +y = ipl_df['winner'].unique() + +plt.bar(x,y) + + + + diff --git a/q03_plot_innings_runs_histogram/build.py b/q03_plot_innings_runs_histogram/build.py index ce53182..455963c 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,16 @@ # Solution +def plot_innings_runs_histogram(): + + inning_wise_runs = ipl_df.groupby(['match_code', 'inning'])['runs'].sum() + first_inning_runs = inning_wise_runs[:,1] + second_inning_runs = inning_wise_runs[:,2] + + fig, axes = plt.subplots(1, 2, sharex=True, sharey=True) + axes[0].hist(first_inning_runs) + axes[1].hist(second_inning_runs) + + + + diff --git a/q04_plot_runs_by_balls/build.py b/q04_plot_runs_by_balls/build.py index ce53182..5414093 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(): + x = ipl_df['delivery'] + y = ipl_df['runs'] + plt.scatter(x,y) + plt.show + +