Skip to main content

Python wrapper around the nwslR library

Project description

nwslpy

nwslpy is a Python wrapper around the data generated by the nwslR package. The goal of this package is to make the data from nwslR available to an even broader audience.

If you see anything you’d like added, changed, or updated, please open up a new issue of your own. If you are interested in contributing, please contact us directly. If you use this data in any work, please cite us.

Installing the package

Install nwspy using the following command:

pip install nwslpy

API

  • load_player_match_stats(match_id): Loads player level stats for a given match
  • load_player_season_stats(team_id, season): Loads player level stats for a team/season
  • load_team_match_stats(match_id): Loads team level stats for a given match
  • load_team_season_stats(team_id, season): Loads team level stats for a team/season
  • load_matches(): All matches from 2016-present with information and match IDs
  • load_players(): All players rostered from 2016-present with information and player IDs
  • load_teams(): All teams active from 2016-present with information and team IDs
  • load_metrics() All metrics available from scrapers with definitions. Not all metrics are available for all players/matches/teams/etc.

Usage

If you wanted to see the list of matches from 2022, you could try:

import nwslpy

# Load all matches and filter to ones in the year 2022
matches = nwslpy.load_matches()
matches[matches["year"] == 2022]

If you wanted to see which players took the most shots in the 2022 NWSL Championship, you could try:

import nwslpy

stats = nwslpy.load_player_match_stats("portland-thorns-fc-vs-kansas-city-current-2022-10-29")
players = nwslpy.load_players()

# Select the columns of interest
stats = stats[["shots_total"]]
# Join with information about the players
stats = stats.join(players)[["shots_total", "player_match_name"]]
# Find the players with the most shots
stats = stats.sort_values("shots_total", ascending=False)

For more complicated examples, including how to visualize the data, check out the examples directory.

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

nwslpy-0.0.0.7000.tar.gz (83.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nwslpy-0.0.0.7000-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file nwslpy-0.0.0.7000.tar.gz.

File metadata

  • Download URL: nwslpy-0.0.0.7000.tar.gz
  • Upload date:
  • Size: 83.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nwslpy-0.0.0.7000.tar.gz
Algorithm Hash digest
SHA256 967094103bb863d5f92bac814142df35c6f7e28516a9e2763fa7e5699ccf5ae2
MD5 7a50407e992935b3fd52032e23c9147b
BLAKE2b-256 2f5d39f8d3762e59f0149e6fd94b42f6dcda090526118d4ef773ddeb0ccb1d21

See more details on using hashes here.

File details

Details for the file nwslpy-0.0.0.7000-py3-none-any.whl.

File metadata

  • Download URL: nwslpy-0.0.0.7000-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nwslpy-0.0.0.7000-py3-none-any.whl
Algorithm Hash digest
SHA256 33b15255fa91befcee75170524088009e534c361aebe11ad14cc072e65360109
MD5 74fc94f4559d80977853b0715df67648
BLAKE2b-256 cad75565becf501e0916ef0f0010b203eeade0081309681851798c076fa5ca10

See more details on using hashes here.

Supported by

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