-
Notifications
You must be signed in to change notification settings - Fork 253
Expand file tree
/
Copy pathbuild.py
More file actions
35 lines (22 loc) · 936 Bytes
/
build.py
File metadata and controls
35 lines (22 loc) · 936 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
33
# %load q07_get_unique_teams_set/build.py
# Default imports
from greyatomlib.python_intermediate.q05_read_csv_data.build import read_ipl_data_csv
path = 'data/ipl_matches_small.csv'
# Enter Code Here
from greyatomlib.python_intermediate.q05_read_csv_data.build import read_ipl_data_csv
path = 'data/ipl_matches_small.csv'
import numpy as np
# Enter Code Here
def get_unique_teams_set():
np_ipl_data = read_ipl_data_csv(path , '|S50')
#team 1 2d array
team_1 = np_ipl_data[1:,[3]]
#reshaping to 1d array
team_1_1d = team_1.reshape(np.product(team_1.shape))
#team 1 2d array
team_2 = np_ipl_data[1:,[4]]
#reshaping to 1d array
team_2_1d = team_2.reshape(np.product(team_2.shape))
#taking union of two lists to remove duplicates and merge two lists in one list
names_of_teames_played = set().union(team_1_1d,team_2_1d)
return names_of_teames_played