fixed loading structure
Browse files- nba_tracking_data_15_16.py +28 -29
nba_tracking_data_15_16.py
CHANGED
@@ -182,38 +182,37 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
|
|
182 |
for event in game["events"]:
|
183 |
event_id = event["eventId"]
|
184 |
for moment in event["moments"]:
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
"
|
201 |
-
|
202 |
-
"
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
"
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
"z": z
|
213 |
-
}
|
214 |
}
|
215 |
}
|
216 |
}
|
|
|
217 |
|
218 |
|
219 |
# for key, row in enumerate(fp):
|
|
|
182 |
for event in game["events"]:
|
183 |
event_id = event["eventId"]
|
184 |
for moment in event["moments"]:
|
185 |
+
quarter = moment[0]
|
186 |
+
game_clock = moment[2]
|
187 |
+
shot_clock = moment[3]
|
188 |
+
ball_coords = moment[5][0][2:]
|
189 |
+
for player in moment[5][1:]:
|
190 |
+
team_id = player[0]
|
191 |
+
player_id = player[1]
|
192 |
+
x = player[2]
|
193 |
+
y = player[3]
|
194 |
+
z = player[4]
|
195 |
+
|
196 |
+
yield game_id, {
|
197 |
+
"gameid": game_id,
|
198 |
+
"gamedate": game_date,
|
199 |
+
"events": {
|
200 |
+
"eventid": event_id,
|
201 |
+
"moments": {
|
202 |
+
"quarter": quarter,
|
203 |
+
"game_clock": game_clock,
|
204 |
+
"shot_clock": shot_clock,
|
205 |
+
"ball_coordinates": ball_coords,
|
206 |
+
"player_coordinates": {
|
207 |
+
"teamid": team_id,
|
208 |
+
"playerid": player_id,
|
209 |
+
"x": x,
|
210 |
+
"y": y,
|
211 |
+
"z": z
|
|
|
|
|
212 |
}
|
213 |
}
|
214 |
}
|
215 |
+
}
|
216 |
|
217 |
|
218 |
# for key, row in enumerate(fp):
|