-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy pathbuild.py
More file actions
27 lines (21 loc) · 765 Bytes
/
build.py
File metadata and controls
27 lines (21 loc) · 765 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
# %load q02_plot_matches_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)
# 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()