quick test
Browse files- nba_tracking_data_15_16.py +23 -40
nba_tracking_data_15_16.py
CHANGED
@@ -85,27 +85,25 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
|
|
85 |
# "jersey": datasets.Value("string"),
|
86 |
# "position": datasets.Value("string")
|
87 |
# })
|
88 |
-
"
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
}
|
108 |
-
)
|
109 |
|
110 |
return datasets.DatasetInfo(
|
111 |
# This is the description that will appear on the datasets page.
|
@@ -158,16 +156,11 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
|
|
158 |
game_date = game["gamedate"]
|
159 |
for event in game["events"]:
|
160 |
event_id = event["eventId"]
|
161 |
-
# quarter = [moment[0] for moment in event["moments"]]
|
162 |
-
# game_clock = [moment[2] for moment in event["moments"]]
|
163 |
-
# shot_clock = [moment[3] for moment in event["moments"]]
|
164 |
-
# ball_coords = [moment[5][0][2:] for moment in event["moments"]]
|
165 |
for moment in event["moments"]:
|
166 |
quarter = moment[0]
|
167 |
game_clock = moment[2]
|
168 |
shot_clock = moment[3]
|
169 |
-
|
170 |
-
ball_coords = moment[5][0][2:]
|
171 |
# for player in moment[5][1:]:
|
172 |
# team_id = player[0]
|
173 |
# player_id = player[1]
|
@@ -184,17 +177,7 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
|
|
184 |
"gameid": game_id,
|
185 |
"gamedate": game_date,
|
186 |
"eventid": event_id,
|
187 |
-
"
|
188 |
-
|
189 |
-
|
190 |
-
"shot_clock": shot_clock,
|
191 |
-
#"ball_coordinates": ball_coords,
|
192 |
-
# "player_coordinates": {
|
193 |
-
# "teamid": team_id,
|
194 |
-
# "playerid": player_id,
|
195 |
-
# "x": x,
|
196 |
-
# "y": y,
|
197 |
-
# "z": z
|
198 |
-
# }
|
199 |
}
|
200 |
-
}
|
|
|
85 |
# "jersey": datasets.Value("string"),
|
86 |
# "position": datasets.Value("string")
|
87 |
# })
|
88 |
+
"quarter": datasets.Value("int16"),
|
89 |
+
"game_clock": datasets.Value("int16"),
|
90 |
+
"shot_clock": datasets.Value("int16"),
|
91 |
+
# "ball_coordinates": datasets.Sequence(
|
92 |
+
# datasets.Value("float32"),
|
93 |
+
# datasets.Value("float32"),
|
94 |
+
# datasets.Value("float32")
|
95 |
+
# ),
|
96 |
+
# "player_coordinates": datasets.Sequence(
|
97 |
+
# {
|
98 |
+
# "teamid": datasets.Value("int64"),
|
99 |
+
# "playerid": datasets.Value("int64"),
|
100 |
+
# "x": datasets.Value("float32"),
|
101 |
+
# "y": datasets.Value("float32"),
|
102 |
+
# "z": datasets.Value("float32")
|
103 |
+
# }
|
104 |
+
# )
|
105 |
+
}
|
106 |
+
)
|
|
|
|
|
107 |
|
108 |
return datasets.DatasetInfo(
|
109 |
# This is the description that will appear on the datasets page.
|
|
|
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]
|
162 |
shot_clock = moment[3]
|
163 |
+
# ball_coords = moment[5][0][2:]
|
|
|
164 |
# for player in moment[5][1:]:
|
165 |
# team_id = player[0]
|
166 |
# player_id = player[1]
|
|
|
177 |
"gameid": game_id,
|
178 |
"gamedate": game_date,
|
179 |
"eventid": event_id,
|
180 |
+
"quarter": quarter,
|
181 |
+
"game_clock": game_clock,
|
182 |
+
"shot_clock": shot_clock
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
}
|
|