hkenawi / FPL-optimizer

This repository contains the source code for an optimizer model that evaluates a user's team and recommends optimal decision making regarding transfers and chip usage
2 stars 0 forks source link

Create weighted average of player offensive data #9

Closed hkenawi closed 2 months ago

hkenawi commented 2 months ago

In src/player_data_processing there is a function named cleanFBRefPlayerOffensiveData. This function cleans the consolidated FBRef player offensive data. Some players played for two teams in one season and thus have two separate lines of statistics for a given season. This is not ideal as when merging with consolidated match-log data it results in duplicated rows. Currently, I am handling wby taking the average of the separate lines of statistics for all columns after grouping by player and season. Ideally we would take a weighted average.

For implementation, refer to line 70 in player_data_processing.py

To accomplish this we need # of games played for the player per season which is available under the column "90s".

hkenawi commented 2 months ago

Completed with most recent push. For those wanting to try and do regardless in your own branches, check my implementation in the player_data_processing script.