You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've updated to the new version of 1.5.2 and I use python 12.4.
I get this error on my version of the notebook for labels in the ATOMIC version - is a bit different from yours since I don't use HDF format - , while the same exact code works perfectly in the non-ATOMIC version.
Do I miss something or I've done something wrong?
The code:
yfns = [lab.scores, lab.concedes, lab.goal_from_shot]
all_labels = []
for game in tqdm.tqdm(list(games.itertuples()), desc="Computing and collecting labels"):
B = atomic_actions[atomic_actions['game_id'] == game.game_id]
Y = pd.concat([fn(atomicspadl.add_names(B)) for fn in yfns], axis=1)
all_labels.append(Y)
labels = pd.concat(all_labels, ignore_index=True)
The error:
Computing and collecting labels: 0%| | 1/6175 [00:00<04:45, 21.60it/s]
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
File ~/anaconda3/envs/VAEP/lib/python3.12/site-packages/pandas/core/indexes/base.py:3805, in Index.get_loc(self, key)
3804 try:
-> 3805 return self._engine.get_loc(casted_key)
3806 except KeyError as err:
File index.pyx:167, in pandas._libs.index.IndexEngine.get_loc()
File index.pyx:196, in pandas._libs.index.IndexEngine.get_loc()
File pandas/_libs/hashtable_class_helper.pxi:2606, in pandas._libs.hashtable.Int64HashTable.get_item()
File pandas/_libs/hashtable_class_helper.pxi:2630, in pandas._libs.hashtable.Int64HashTable.get_item()
KeyError: 2271
The above exception was the direct cause of the following exception:
KeyError Traceback (most recent call last)
Cell In[9], line 6
4 for game in tqdm.tqdm(list(games.itertuples()), desc="Computing and collecting labels"):
5 B = atomic_actions[atomic_actions['game_id'] == game.game_id]
----> 6 Y = pd.concat([fn(atomicspadl.add_names(B)) for fn in yfns], axis=1)
7 all_labels.append(Y)
9 labels = pd.concat(all_labels, ignore_index=True)
File ~/anaconda3/envs/VAEP/lib/python3.12/site-packages/socceraction/atomic/vaep/labels.py:37, in scores(actions, nr_actions)
35 for c in ["team_id", "goal", "owngoal"]:
36 shifted = y[c].shift(-i)
---> 37 shifted[-i:] = y[c][len(y) - 1]
38 y["%s+%d" % (c, i)] = shifted
40 res = y["goal"]
File ~/anaconda3/envs/VAEP/lib/python3.12/site-packages/pandas/core/series.py:1121, in Series.__getitem__(self, key)
1118 return self._values[key]
1120 elif key_is_scalar:
-> 1121 return self._get_value(key)
1123 # Convert generator to list before going through hashable part
1124 # (We will iterate through the generator there to check for slices)
1125 if is_iterator(key):
File ~/anaconda3/envs/VAEP/lib/python3.12/site-packages/pandas/core/series.py:1237, in Series._get_value(self, label, takeable)
1234 return self._values[label]
1236 # Similar to Index.get_value, but we do not fall back to positional
-> 1237 loc = self.index.get_loc(label)
1239 if is_integer(loc):
1240 return self._values[loc]
File ~/anaconda3/envs/VAEP/lib/python3.12/site-packages/pandas/core/indexes/base.py:3812, in Index.get_loc(self, key)
3807 if isinstance(casted_key, slice) or (
3808 isinstance(casted_key, abc.Iterable)
3809 and any(isinstance(x, slice) for x in casted_key)
3810 ):
3811 raise InvalidIndexError(key)
-> 3812 raise KeyError(key) from err
3813 except TypeError:
3814 # If we have a listlike key, _check_indexing_error will raise
3815 # InvalidIndexError. Otherwise we fall through and re-raise
3816 # the TypeError.
3817 self._check_indexing_error(key)
KeyError: 2271
The text was updated successfully, but these errors were encountered:
This commit fixes a bug in the scores and concedes functions in atomic vaep,
where the intention is to grab the last element in the dataframe and assign that
value to the end of the shifted dataframe.
See also #718Fixes#749
I've updated to the new version of 1.5.2 and I use python 12.4.
I get this error on my version of the notebook for labels in the ATOMIC version - is a bit different from yours since I don't use HDF format - , while the same exact code works perfectly in the non-ATOMIC version.
Do I miss something or I've done something wrong?
The code:
The error:
The text was updated successfully, but these errors were encountered: