Chrisjb / fploptimiser

FPL Team Optimiser
6 stars 0 forks source link

Player being replicated and team name mismatches #3

Closed ghdevin closed 3 years ago

ghdevin commented 3 years ago

Using the following conditions, it looks like Reece James some how gets replicated (in some cases I have seen him pop up 3 times in one [optimized] team). Also his team name is assigned Crystal Palace instead of Chelsea. Similarly, Tarkowski's team name is Chelsea now instead of Burnley.

df_xp <- fetch_xg_data(year = 2021)

result_xp <- optimise_team(objective = 'ppg', bank = 1000, bench_value = 0, gk = 2, def = 5, mid = 5, fwd = 3, custom_df = df_xp, min_games = 15)

No rush, just thought I would point it out.

Chrisjb commented 3 years ago

Thanks I haven't checked the code works for the latest season. WIll do some debugging shortly

Chrisjb commented 3 years ago

4 should have fixed the players not matching. When trying to match previous season's data (understat 2019/20) to the newest fpl data the team codes are different eg. the code for Chelsea is no longer 5 since Brentford was promoted, meaning Chelsea is now 6th alphabetically.

The new method of matching no longer relies on team codes but rather cleans up the team names so they can be matched on name.