quick test
Browse files- nba_tracking_data_15_16.py +35 -35
nba_tracking_data_15_16.py
CHANGED
@@ -161,42 +161,42 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
|
|
161 |
game_date = game["gamedate"]
|
162 |
for event in game["events"]:
|
163 |
event_id = event["eventId"]
|
164 |
-
quarter = [moment[0] for moment in event["moments"]]
|
165 |
-
game_clock = [moment[2] for moment in event["moments"]]
|
166 |
-
shot_clock = [moment[3] for moment in event["moments"]]
|
167 |
-
ball_coords = [moment[5][0][2:] for moment in event["moments"]]
|
168 |
for moment in event["moments"]:
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
for player in moment[5][1:]:
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
}
|
202 |
}
|
|
|
|
161 |
game_date = game["gamedate"]
|
162 |
for event in game["events"]:
|
163 |
event_id = event["eventId"]
|
164 |
+
# quarter = [moment[0] for moment in event["moments"]]
|
165 |
+
# game_clock = [moment[2] for moment in event["moments"]]
|
166 |
+
# shot_clock = [moment[3] for moment in event["moments"]]
|
167 |
+
# ball_coords = [moment[5][0][2:] for moment in event["moments"]]
|
168 |
for moment in event["moments"]:
|
169 |
+
quarter = moment[0]
|
170 |
+
game_clock = moment[2]
|
171 |
+
shot_clock = moment[3]
|
172 |
+
ball_coords = moment[5][0][2:]
|
173 |
+
# for player in moment[5][1:]:
|
174 |
+
# team_id = player[0]
|
175 |
+
# player_id = player[1]
|
176 |
+
# x = player[2]
|
177 |
+
# y = player[3]
|
178 |
+
# z = player[4]
|
179 |
|
180 |
+
moment_id += 1
|
181 |
+
# moment_id stop
|
182 |
+
if moment_id > 1000:
|
183 |
+
break
|
184 |
|
185 |
+
yield moment_id, {
|
186 |
+
"gameid": game_id,
|
187 |
+
"gamedate": game_date,
|
188 |
+
"eventid": event_id,
|
189 |
+
"moments": {
|
190 |
+
"quarter": quarter,
|
191 |
+
"game_clock": game_clock,
|
192 |
+
"shot_clock": shot_clock,
|
193 |
+
#"ball_coordinates": ball_coords,
|
194 |
+
# "player_coordinates": {
|
195 |
+
# "teamid": team_id,
|
196 |
+
# "playerid": player_id,
|
197 |
+
# "x": x,
|
198 |
+
# "y": y,
|
199 |
+
# "z": z
|
200 |
+
# }
|
|
|
201 |
}
|
202 |
+
}
|