add visitor
Browse files- nba_tracking_data_15_16.py +20 -12
nba_tracking_data_15_16.py
CHANGED
@@ -62,18 +62,18 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
|
|
62 |
"gamedate": datasets.Value("string"),
|
63 |
# question: how to indicate list of dictionaries?
|
64 |
"eventid": datasets.Value("string"),
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
# "home": {
|
78 |
# "name": datasets.Value("string"),
|
79 |
# "teamid": datasets.Value("int64"),
|
@@ -156,6 +156,9 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
|
|
156 |
game_date = game["gamedate"]
|
157 |
for event in game["events"]:
|
158 |
event_id = event["eventId"]
|
|
|
|
|
|
|
159 |
for moment in event["moments"]:
|
160 |
quarter = moment[0]
|
161 |
game_clock = moment[2]
|
@@ -179,6 +182,11 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
|
|
179 |
"gameid": game_id,
|
180 |
"gamedate": game_date,
|
181 |
"eventid": event_id,
|
|
|
|
|
|
|
|
|
|
|
182 |
"quarter": quarter,
|
183 |
"game_clock": game_clock,
|
184 |
"shot_clock": shot_clock,
|
|
|
62 |
"gamedate": datasets.Value("string"),
|
63 |
# question: how to indicate list of dictionaries?
|
64 |
"eventid": datasets.Value("string"),
|
65 |
+
"visitor": {
|
66 |
+
"name": datasets.Value("string"),
|
67 |
+
"teamid": datasets.Value("int64"),
|
68 |
+
"abbreviation": datasets.Value("string"),
|
69 |
+
# "players": datasets.Sequence({
|
70 |
+
# "lastname": datasets.Value("string"),
|
71 |
+
# "firstname": datasets.Value("string"),
|
72 |
+
# "playerid": datasets.Value("int64"),
|
73 |
+
# "jersey": datasets.Value("string"),
|
74 |
+
# "position": datasets.Value("string")
|
75 |
+
# })
|
76 |
+
},
|
77 |
# "home": {
|
78 |
# "name": datasets.Value("string"),
|
79 |
# "teamid": datasets.Value("int64"),
|
|
|
156 |
game_date = game["gamedate"]
|
157 |
for event in game["events"]:
|
158 |
event_id = event["eventId"]
|
159 |
+
visitor_name = event['visitor']['name']
|
160 |
+
visitor_team_id = event['visitor']['teamid']
|
161 |
+
visitor_abbrev = event['visitor']['abbreviation']
|
162 |
for moment in event["moments"]:
|
163 |
quarter = moment[0]
|
164 |
game_clock = moment[2]
|
|
|
182 |
"gameid": game_id,
|
183 |
"gamedate": game_date,
|
184 |
"eventid": event_id,
|
185 |
+
"visitor": {
|
186 |
+
"name": visitor_name,
|
187 |
+
"teamid": visitor_team_id,
|
188 |
+
"abbreviation": visitor_abbrev
|
189 |
+
}
|
190 |
"quarter": quarter,
|
191 |
"game_clock": game_clock,
|
192 |
"shot_clock": shot_clock,
|