dcayton commited on
Commit
9d45195
1 Parent(s): dee69c3

add ball_coards 2.0

Browse files
Files changed (1) hide show
  1. nba_tracking_data_15_16.py +13 -7
nba_tracking_data_15_16.py CHANGED
@@ -88,11 +88,11 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
88
  "quarter": datasets.Value("int64"),
89
  "game_clock": datasets.Value("float32"),
90
  "shot_clock": datasets.Value("float32"),
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"),
@@ -160,7 +160,9 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
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]
@@ -180,5 +182,9 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
180
  "quarter": quarter,
181
  "game_clock": game_clock,
182
  "shot_clock": shot_clock,
183
- "ball_coordinates": ball_coords
 
 
 
184
  }
 
 
88
  "quarter": datasets.Value("int64"),
89
  "game_clock": datasets.Value("float32"),
90
  "shot_clock": datasets.Value("float32"),
91
+ "ball_coordinates": {
92
+ "x": datasets.Value("float32"),
93
+ "y": datasets.Value("float32"),
94
+ "z": datasets.Value("float32")
95
+ },
96
  # "player_coordinates": datasets.Sequence(
97
  # {
98
  # "teamid": datasets.Value("int64"),
 
160
  quarter = moment[0]
161
  game_clock = moment[2]
162
  shot_clock = moment[3]
163
+ ball_coords_x = moment[5][0][2]
164
+ ball_coords_y = moment[5][0][3]
165
+ ball_coords_z = moment[5][0][4]
166
  for player in moment[5][1:]:
167
  team_id = player[0]
168
  player_id = player[1]
 
182
  "quarter": quarter,
183
  "game_clock": game_clock,
184
  "shot_clock": shot_clock,
185
+ "ball_coordinates": {
186
+ "x": ball_coords_x,
187
+ "y": ball_coords_y,
188
+ "z": ball_coords_z
189
  }
190
+ }