Penalty Blog Logo

penaltyblog: Football Data & Modelling Made Easy#

penaltyblog is a production-ready Python package designed for football (soccer) analytics, providing powerful tools from pena.lt/y/blog for data analysis, outcome modelling, and betting insights. Optimized with Cython, penaltyblog delivers high-performance modelling to power faster, efficient predictions.

Features#

  • πŸ”„ Streamline JSON Workflows with MatchFlow – Process deeply nested football event data using a lazy, streaming pipeline built for JSON. Filter, select, flatten, join, group, and summarize large datasets - all without loading everything into memory.

  • ⚽ Scrape Data – Collect match statistics from sources like FBRef, Understat, Club Elo, and Fantasy Premier League.

  • πŸ“Š Model Matches Efficiently – High-performance implementations of Poisson, Bivariate Poisson, Dixon-Coles, and other advanced statistical models, optimized with Cython for rapid analysis.

  • πŸ’° Bet Smarter – Precisely estimate probabilities for Asian handicaps, over/under totals, match outcomes, and more.

  • πŸ† Rank Teams – Evaluate team strengths with sophisticated methods including Elo, Massey, Colley, and Pi ratings.

  • πŸ“ˆ Decode Bookmaker Odds – Accurately extract implied probabilities by removing bookmaker margins (overrounds).

  • 🎯 Fantasy Football Optimisation – Mathematically optimize your fantasy football squad to maximize performance.

Take your football analytics and betting strategy to the next level with penaltyblog πŸš€

Installation#

pip install penaltyblog

Quick Start - Try it Now!#

Run these examples directly in your browser (no installation required):

Example

Description

Colab

Predict Soccer Match Results

Build a match prediction model from scratch

Open In Colab

Process Soccer Data the Easy Way

Lazy processing of football data using Matchflow

Open In Colab

Calculate Massey Ratings

Calculate teams’ attack and defense strengths

Open In Colab

Use Pi Ratings

Like Elo ratings, but better

Open In Colab

Create Interactive Charts

Create your own interactive football vizualisations

Open In Colab

Work Directly With Statsbomb Data

Connect directly to Statsbomb’s API, including their free open data sets

Open In Colab

Resources & References