-
Notifications
You must be signed in to change notification settings - Fork 253
Expand file tree
/
Copy pathbuild.py
More file actions
37 lines (31 loc) · 950 Bytes
/
build.py
File metadata and controls
37 lines (31 loc) · 950 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
34
# %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'
import numpy as np
import csv
# Enter Code Here
def get_unique_teams_set():
with open(path, 'r') as f:
reader = csv.reader(f, delimiter=',')
headers = next(reader)
data = list(reader)
ar1=np.array(data)
team1=set(ar1[:,3].astype('|S50'))
team2=set(ar1[:,4].astype('|S50'))
unio=team1.union(team2)
return unio
get_unique_teams_set()
path = 'data/ipl_matches_small.csv'
import numpy as np
import csv
with open(path, 'r') as f:
reader = csv.reader(f, delimiter=',')
headers = next(reader)
data = list(reader)
ar1=np.array(data)
team1=set(np.unique(ar1[0:,3:4]))
team2=set(np.unique(ar1[0:,4:5]))
print(team1)
print(team2)
print (type((team1.union(team2))))