Closed jack89roberts closed 2 years ago
Currently causes some prediction attempts for 20/21 season to fail:
Traceback (most recent call last):
File "/Users/jroberts/opt/anaconda3/envs/airsenalenv/bin/airsenal_run_prediction", line 33, in <module>
sys.exit(load_entry_point('airsenal', 'console_scripts', 'airsenal_run_prediction')())
File "/Users/jroberts/GitHub/AIrsenal/airsenal/scripts/fill_predictedscore_table.py", line 264, in main
tag = make_predictedscore_table(
File "/Users/jroberts/GitHub/AIrsenal/airsenal/scripts/fill_predictedscore_table.py", line 185, in make_predictedscore_table
calc_all_predicted_points(
File "/Users/jroberts/GitHub/AIrsenal/airsenal/scripts/fill_predictedscore_table.py", line 152, in calc_all_predicted_points
predictions = calc_predicted_points_for_player(
File "/Users/jroberts/GitHub/AIrsenal/airsenal/framework/prediction_utils.py", line 300, in calc_predicted_points_for_player
df_player[position].loc[player.player_id]
KeyError: 'name\nBen Davies DEF\nBen Davies DEF\nName: position, dtype: object'
Proposal: Rename players in historic data:
For future occurrences:
airsenal/scripts/duplicate_names.py
will print the names and IDs of players with clashing names.
Liverpool have signed a player called Ben Davies. Spurs already have a player called Ben Davies. Havoc ensues since we use names as the basis for our unique identifiers. FIFA are yet to respond to our demands for all football players to have unique stage names like actors.
This also happened in the 18/19 season with two Danny Wards, see #90. Tricky to fix because we have no other way to match player histories between seasons, besides creating a record ourselves for these edge cases maybe (FPL player IDs change each season, at least the ones they make public in the API).
This is currently causing some issues with
airsenal_update_db
(no player found with FPL API ID 653, which is the Liverpool Ben Davies).