-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy pathbuild.py
More file actions
24 lines (16 loc) · 718 Bytes
/
build.py
File metadata and controls
24 lines (16 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# %load q03_plot_innings_runs_histogram/build.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.switch_backend('agg')
ipl_df = pd.read_csv('data/ipl_dataset.csv', index_col=None)
# 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)