Skip to main content

Stats and Visualizations for FPL, Fantasy Allsvenskan and Fantasy Eliteserien

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fantasy-premier-league-stats-0.0.2.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file fantasy-premier-league-stats-0.0.2.tar.gz.

File metadata

  • Download URL: fantasy-premier-league-stats-0.0.2.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for fantasy-premier-league-stats-0.0.2.tar.gz
Algorithm Hash digest
SHA256 07b2e6d0cb287ea7535766d27e7d6307e82db581888db6eb80bb086c6745e523
MD5 5775e80e476be282750234fd141935a3
BLAKE2b-256 51b2b8e6aa543cfad0719861eef91bc173d13e26954d083f9c4b28daaeeb5c74

See more details on using hashes here.

File details

Details for the file fantasy_premier_league_stats-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: fantasy_premier_league_stats-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for fantasy_premier_league_stats-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5c008a63087030b2f450349de9ae21a8ec5fb77a49e5f4057e72d5dc4d903bbe
MD5 f3e11675146b8a31ab6a0cf5203a113f
BLAKE2b-256 428afa4a0eb372f23558183ed8182efbb7826717be2658816f03e1f0d378c31e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page