edited key to moment id
Browse files
nba_tracking_data_15_16.py
CHANGED
@@ -175,6 +175,7 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
|
|
175 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
176 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
177 |
for game_title, link in filepaths.items():
|
|
|
178 |
with open(link, encoding="utf-8") as fp:
|
179 |
game = json.load(fp)
|
180 |
game_id = game["gameid"]
|
@@ -192,8 +193,9 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
|
|
192 |
x = player[2]
|
193 |
y = player[3]
|
194 |
z = player[4]
|
195 |
-
|
196 |
-
|
|
|
197 |
"gameid": game_id,
|
198 |
"gamedate": game_date,
|
199 |
# "events": {
|
|
|
175 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
176 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
177 |
for game_title, link in filepaths.items():
|
178 |
+
moment_id = 0
|
179 |
with open(link, encoding="utf-8") as fp:
|
180 |
game = json.load(fp)
|
181 |
game_id = game["gameid"]
|
|
|
193 |
x = player[2]
|
194 |
y = player[3]
|
195 |
z = player[4]
|
196 |
+
|
197 |
+
moment_id += 1
|
198 |
+
yield moment_id, {
|
199 |
"gameid": game_id,
|
200 |
"gamedate": game_date,
|
201 |
# "events": {
|