-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy pathbuild.py
More file actions
34 lines (26 loc) · 737 Bytes
/
build.py
File metadata and controls
34 lines (26 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# %load q01_plot_deliveries_by_team/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)
def plot_deliveries_by_team():
c=ipl_df.groupby('batting_team').agg({'delivery':'count'}).reset_index()
c.plot(kind='bar')
plt.xticks(index,list(c['batting_team']))
plt.xlabel('Batting team')
plt.ylabel('Deliveries')
plt.show()
c=ipl_df.groupby('batting_team').agg({'delivery':'count'}).reset_index()
c['delivery']
type(c)
c.iloc[:,0]
c=c.reset_index()
c.iloc[:,0]
ax=c[['batting_team','delivery']].plot(kind='bar')
plt.show()
ax
ax=c[['batting_team','delivery']].plot(kind='bar')
ax
plt.show()
ax