-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.py
41 lines (32 loc) · 924 Bytes
/
test.py
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
35
36
37
38
39
40
41
import csv, json
import pandas as pd
PATH = "assets/ifg_sched_2.csv"
# 0 1 2 3 4 5 6 7
# Week, Date, Day, Time, Sport, Gender, Category, Venue
data = pd.read_csv(PATH).values.tolist()
print (data)
collection = {
'data': []
}
for rec in data:
name = rec[4].strip()
gender = rec[5].strip()
all_tags = []
if gender == "M": # M, W, U, B
all_tags.append("men's")
elif gender == "W":
all_tags.append("women's")
elif gender == "U":
all_tags.append("men's")
all_tags.append("women's")
# all_tags.append(str(rec[6]))
all_tags.append(str(rec[0]).strip())
collection['data'].append({
"title": name,
"tags": all_tags,
"time": rec[3],
"date": rec[2].title() + ", " + rec[1].replace("/", "-"),
"venue": rec[7]
})
with open('ifg_json.json', "a") as f:
json.dump(collection, f)