dcayton commited on
Commit
e5d9cc0
1 Parent(s): 5c53493

change config for items

Browse files
Files changed (1) hide show
  1. nba_tracking_data_15_16.py +4 -9
nba_tracking_data_15_16.py CHANGED
@@ -20,6 +20,7 @@ import py7zr
20
 
21
  import datasets
22
  import requests
 
23
 
24
  import pandas as pd
25
 
@@ -46,6 +47,9 @@ res = requests.get(_URL)
46
 
47
  items = res.json()['payload']['tree']['items']
48
 
 
 
 
49
  _URLS = {}
50
  for game in items:
51
  name = game['name'][:-3]
@@ -76,15 +80,6 @@ def identify_offense(row):
76
  class NbaTracking(datasets.GeneratorBasedBuilder):
77
  """Tracking data for all games of 2015-2016 season in forms of coordinates for players and ball at each moment."""
78
 
79
- def __init__(self, *args, **kwargs, games_loaded = len(items)):
80
- super().__init__(*args, **kwargs)
81
- self.games_loaded = games_loaded
82
-
83
- _URLS = {}
84
- for game in items[0:self.games_loaded]:
85
- name = game['name'][:-3]
86
- _URLS[name] = _URL + "/" + name + ".7z"
87
-
88
  _URLS = _URLS
89
  _PBP_URL = _PBP_URL
90
 
 
20
 
21
  import datasets
22
  import requests
23
+ import random
24
 
25
  import pandas as pd
26
 
 
47
 
48
  items = res.json()['payload']['tree']['items']
49
 
50
+ random.seed()
51
+ items = random.sample(items, 50)
52
+
53
  _URLS = {}
54
  for game in items:
55
  name = game['name'][:-3]
 
80
  class NbaTracking(datasets.GeneratorBasedBuilder):
81
  """Tracking data for all games of 2015-2016 season in forms of coordinates for players and ball at each moment."""
82
 
 
 
 
 
 
 
 
 
 
83
  _URLS = _URLS
84
  _PBP_URL = _PBP_URL
85