sportsball

A library for pulling in and normalising sports stats.


Keywords
monte, carlo
License
MIT
Install
pip install sportsball==0.0.1

Documentation

sportsball

PyPi

A library for pulling in and normalising sports stats.

sportsball

Dependencies ๐ŸŒ

Python 3.11.6:

Raison D'รชtre ๐Ÿ’ญ

sportsball aims to be a library for pulling in historical information about previous sporting games in a standardised fashion for easy data processing. The models it uses are designed to be used for many different types of sports.

The supported leagues are:

  • ๐Ÿˆ NFL

Architecture ๐Ÿ“

sportsball is an object orientated library. The entities are organised like so:

  • League: The entry point to accessing data about a league.
    • Season: A season within a league.
      • Game: A game within a season.
        • Team: The team within the game. Note that in games with individual players a team exists as a wrapper.
          • Player: A player within the team.
          • Odds: The odds for the team to win the game.
            • Bookie: The bookie publishing the odds.
        • Venue: The venue the game was played in.
          • Address: The address information of a venue.

Caching

This library uses very aggressive caching due to the large data requirements. The initial data load will take some time however after that it will cache the old data for up to 1 year.

Installation ๐Ÿ“ฅ

This is a python package hosted on pypi, so to install simply run the following command:

pip install sportsball

Usage example ๐Ÿ‘€

To pull a dataframe containing all the information for a particular league, the following example can be used:

import logging
import sportsball as spb

logging.basicConfig(level='DEBUG')
ball = spb.SportsBall()
league = ball.league(spb.League.NFL)
df = league.to_frame()

This results in a dataframe where each game is represented by all its features.

License ๐Ÿ“

The project is available under the MIT License.