Skip to main content

Build Status

Fantasy Premier League variants Stats and Visualization

This project contains a package for collecting captaincy, chip usage, ownership, effective ownership, template team stats from Fantasy Premier League, Fantasy Allsvenskan, and Fantasy Eliteserien.

Installation

To be able to run the package, you have to have Python 3+ installed on your computer.

Check if you have python and pip available. If not you have to install them.

After running the following command, you are ready to go:

pip install fantasy-premier-league-stats

Usage

First, you have to choose one of the games: FPL, ALLSVENSKAN or ELITESERIEN.

To be able to collect stats and create visualizations, you need to get player information and also the teams.

players = api.get_players(game)
team_ids = api.get_league(league_id, max_players, game)
teams = api.get_league_team_picks(team_ids, gameweek, game)

After this, you can get the statistics and plot them if you want (after necessary imports):

chip_usage = chips.get_weekly_chip_usage(teams, percentage=True)
captaincy = captains.get_captaincy_stats(teams, players, percentage=True)
ownership_stats = ownership.get_ownership_stats(teams, players)
effective_ownership_stats = ownership.get_effective_ownership_stats(teams, players)
template = template_team.create_template_team(teams, players, effective=True, percentage=True, with_team=True)

plots.draw_chip_usage(chip_usage)
plots.draw_captaincy_stats(captaincy)
plots.draw_ownership_stats(ownership_stats)
plots.draw_effective_ownership_stats(effective_ownership_stats)
plots.draw_template_team(template, game)

You can either see the plots while running your script or save them to a path of your choice.

Another point is that team picks are cached in path ~/.fpl folder, and if you do not want to download team picks again, you can add overwrite=False to api.get_league_team_picks function call. If you want to clear the directory, you can run clear_directory function in utilities.

Future Improvements and Contributing

I do not plan to enhance the package into containing live stats, but all contributions are welcome. You can create issues for feature requests and bugs. You can also contribute by adding features and creating pull requests.

Metadata

Release files for fantasy-premier-league-stats 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fantasy-premier-league-stats 0.0.2
File Size Uploaded
fantasy-premier-league-stats-0.0.2.tar.gz 18.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fantasy-premier-league-stats 0.0.2
File Interpreter ABI Platform
fantasy_premier_league_stats-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 42.5 kB

Release files / fantasy-premier-league-stats-0.0.2.tar.gz

Download URL fantasy-premier-league-stats-0.0.2.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
07b2e6d0cb287ea7535766d27e7d6307e82db581888db6eb80bb086c6745e523
BLAKE2b-256 checksum
How to use checksums
51b2b8e6aa543cfad0719861eef91bc173d13e26954d083f9c4b28daaeeb5c74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.4

Release files / fantasy_premier_league_stats-0.0.2-py3-none-any.whl

Download URL fantasy_premier_league_stats-0.0.2-py3-none-any.whl
Size 24.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c008a63087030b2f450349de9ae21a8ec5fb77a49e5f4057e72d5dc4d903bbe
BLAKE2b-256 checksum
How to use checksums
428afa4a0eb372f23558183ed8182efbb7826717be2658816f03e1f0d378c31e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.4

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page