data
data
¶
Data loading and schema definitions.
FPLDataLoader
¶
Load and manage FPL data from various sources (API, CSV, cache).
| PARAMETER | DESCRIPTION |
|---|---|
cache_dir
|
Directory to cache downloaded data
TYPE:
|
Source code in fplx/data/loaders.py
fetch_bootstrap_data
¶
Fetch main FPL data (players, teams, gameweeks).
| PARAMETER | DESCRIPTION |
|---|---|
force_refresh
|
Force refresh even if cached
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dict
|
Bootstrap data containing players, teams, events |
Source code in fplx/data/loaders.py
load_players
¶
load_players(force_refresh: bool = False) -> list[Player]
Load all players with basic info.
| PARAMETER | DESCRIPTION |
|---|---|
force_refresh
|
Force refresh from API
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Player]
|
List of Player objects |
Source code in fplx/data/loaders.py
load_player_history
¶
Load detailed historical data for a specific player.
| PARAMETER | DESCRIPTION |
|---|---|
player_id
|
Player ID
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
Historical gameweek stats |
Source code in fplx/data/loaders.py
load_fixtures
¶
Load all fixtures.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
Fixtures data |
Source code in fplx/data/loaders.py
load_from_csv
¶
Load data from CSV file.
| PARAMETER | DESCRIPTION |
|---|---|
filepath
|
Path to CSV file
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
Loaded data |
Source code in fplx/data/loaders.py
enrich_player_history
¶
Enrich players with full historical data.
| PARAMETER | DESCRIPTION |
|---|---|
players
|
List of players to enrich
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Player]
|
Players with enriched timeseries |
Source code in fplx/data/loaders.py
VaastavLoader
¶
VaastavLoader(
season: str = "2023-24",
data_dir: Optional[str | Path] = None,
cache_dir: Optional[str | Path] = None,
)
Load historical FPL data from the vaastav dataset.
| PARAMETER | DESCRIPTION |
|---|---|
season
|
Season string, e.g. "2023-24".
TYPE:
|
data_dir
|
Path to a local clone. If None, fetches from GitHub.
TYPE:
|
cache_dir
|
Where to cache downloaded CSVs. Defaults to ~/.fplx/vaastav/.
TYPE:
|
Source code in fplx/data/vaastav_loader.py
load_merged_gw
¶
Load the merged gameweek file (all GWs, all players, one CSV).
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
One row per player-gameweek appearance. |
Source code in fplx/data/vaastav_loader.py
load_player_raw
¶
Load season-level player metadata.
load_gameweek
¶
build_player_objects
¶
build_player_objects(
up_to_gw: Optional[int] = None,
) -> list[Player]
Build Player objects with timeseries up to a given gameweek.
| PARAMETER | DESCRIPTION |
|---|---|
up_to_gw
|
Only include gameweeks 1..up_to_gw. If None, include all.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Player]
|
|
Source code in fplx/data/vaastav_loader.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |
get_actual_points
¶
Get actual points scored by each player in a specific gameweek.
For Double Gameweek players (two fixtures in the same round) the
points from both fixtures are summed, which is the correct FPL
score for that gameweek. The previous implementation used dict(zip(…))
which silently discarded the first fixture row when a player appeared
twice, underreporting DGW scores.
| RETURNS | DESCRIPTION |
|---|---|
dict[int, float]
|
{player_id: actual_points} (summed across fixtures for DGW players) |
Source code in fplx/data/vaastav_loader.py
get_fixture_info
¶
Get fixture context (opponent, home/away, xP) per player for a GW.