dcayton commited on
Commit
b53de13
1 Parent(s): 4144c8e

change types

Browse files
Files changed (1) hide show
  1. nba_tracking_data_15_16.py +8 -8
nba_tracking_data_15_16.py CHANGED
@@ -64,11 +64,11 @@ def home_away_event_conversion(number):
64
  def identify_offense(row):
65
  identified_offense_events = [1, 2, 3, 4, 5]
66
  if int(row['EVENTMSGTYPE'].item()) in identified_offense_events:
67
- poss_team_id = int(row['PLAYER1_TEAM_ID'].item())
68
  elif ("OFF.FOUL" in str(row["HOMEDESCRIPTION"].item())) or ("OFF.FOUL" in str(row["VISITORDESCRIPTION"].item())):
69
- poss_team_id = int(row['PLAYER1_TEAM_ID'].item())
70
  elif int(row['EVENTMSGTYPE'].item()) == 6:
71
- poss_team_id = int(row['PLAYER2_TEAM_ID'].item())
72
  else:
73
  poss_team_id = None
74
  return poss_team_id
@@ -86,17 +86,17 @@ class NbaTracking(datasets.GeneratorBasedBuilder):
86
  "gamedate": datasets.Value("string"),
87
  "event_info": {"id": datasets.Value("string"),
88
  "type": datasets.Value("int64"),
89
- "possession_team_id": datasets.Value("int64"),
90
  "desc_home": datasets.Value("string"),
91
  "desc_away": datasets.Value("string")
92
  },
93
  "primary_info": {"team": datasets.Value("string"),
94
- "player_id": datasets.Value("int64"),
95
- "team_id": datasets.Value("int64")
96
  },
97
  "secondary_info": {"team": datasets.Value("string"),
98
- "player_id": datasets.Value("int64"),
99
- "team_id": datasets.Value("int64")
100
  },
101
  "visitor": {
102
  "name": datasets.Value("string"),
 
64
  def identify_offense(row):
65
  identified_offense_events = [1, 2, 3, 4, 5]
66
  if int(row['EVENTMSGTYPE'].item()) in identified_offense_events:
67
+ poss_team_id = row['PLAYER1_TEAM_ID'].item()
68
  elif ("OFF.FOUL" in str(row["HOMEDESCRIPTION"].item())) or ("OFF.FOUL" in str(row["VISITORDESCRIPTION"].item())):
69
+ poss_team_id = row['PLAYER1_TEAM_ID'].item()
70
  elif int(row['EVENTMSGTYPE'].item()) == 6:
71
+ poss_team_id = row['PLAYER2_TEAM_ID'].item()
72
  else:
73
  poss_team_id = None
74
  return poss_team_id
 
86
  "gamedate": datasets.Value("string"),
87
  "event_info": {"id": datasets.Value("string"),
88
  "type": datasets.Value("int64"),
89
+ "possession_team_id": datasets.Value("float32"),
90
  "desc_home": datasets.Value("string"),
91
  "desc_away": datasets.Value("string")
92
  },
93
  "primary_info": {"team": datasets.Value("string"),
94
+ "player_id": datasets.Value("float32"),
95
+ "team_id": datasets.Value("float32")
96
  },
97
  "secondary_info": {"team": datasets.Value("string"),
98
+ "player_id": datasets.Value("float32"),
99
+ "team_id": datasets.Value("float32")
100
  },
101
  "visitor": {
102
  "name": datasets.Value("string"),