DataBall is an open-source Python tool that predicts NBA winners against the spread by combining player statistics from stats.nba.com with betting lines scraped from covers.com. The project is built around a machine-learning pipeline that stores historical data in SQLite, models it with scikit-learn, and documents every step in Jupyter notebooks and a GitHub Pages site.
What is DataBall?
DataBall is a Python-based sports analytics project that uses machine learning to forecast whether NBA teams cover the point spread. It takes in team and player statistics via the nba_api package, point-spread and over/under lines scraped from covers.com using Scrapy, and produces predictions trained with scikit-learn. The repository also includes a SQLite database of historical data, Jupyter notebooks with all analyses, and LaTeX files for a report and slides.
Key Features
- Statistics collection — Pulls NBA player and team stats from stats.nba.com using the nba_api package.
- Betting-line scraping — A Scrapy project under the
coversdirectory scrapes point spreads and over/under lines from covers.com. - Machine learning predictions — Uses scikit-learn to train models that predict winners against the spread.
- SQLite storage — Stats are saved to a SQLite database; a test database covering 1990 through March 2020 is available as a downloadable .db file.
- Season simulation — The Python module includes support functions for simulating NBA seasons.
- Jupyter notebooks — All analyses are documented in notebooks under the
notebooksdirectory. - Documentation site — A GitHub Pages site built with Jekyll is maintained in the
docsdirectory.
Who is it for?
- Sports bettors — Get data-driven forecasts for NBA against-the-spread and over/under bets.
- Data scientists — Study an end-to-end example of scraping, storing, and modeling sports data with Python.
- Python developers — Learn how to use Scrapy and nba_api for building data pipelines.
What can you do with DataBall?
- Predict NBA outcomes — Train models on historical stats and betting lines to generate spread predictions for upcoming games.
- Explore historical data — Use the included test database (1990–March 2020) to run your own queries and analyses.
- Simulate seasons — Use the season-simulation functions to test betting strategies against historical data.
How does DataBall work?
DataBall works in three steps: it pulls NBA statistics from stats.nba.com via nba_api, scrapes point spreads and over/under lines from covers.com with a Scrapy spider, and then trains scikit-learn models on the combined data to predict whether teams cover the spread. All code is written in Python, and the data is stored in a SQLite database for reuse.
FAQ
Is DataBall free?
Yes, DataBall is an open-source project hosted on GitHub, so the source code is freely available to view, use, and modify.
What data does DataBall use?
DataBall uses NBA statistics from stats.nba.com retrieved through the nba_api package and point-spread and over/under lines scraped from covers.com using Scrapy.
What machine learning library does DataBall use?
DataBall uses scikit-learn to train its prediction models.
How does DataBall store data?
Collected statistics are stored in a SQLite database. A test database with data from 1990 to March 2020 is available for download in the repository.
Does DataBall include documentation?
Yes, the project includes a GitHub Pages site built with Jekyll, plus Jupyter notebooks that document all analyses.








