Learn to Code with Fantasy Football

Python. Pandas. Web Scraping. Databases. SQL. Machine Learning. APIs.

All applied to Fantasy Football

Fantasy Football is a great gateway to coding

Learning to code isn't hard, you just need to stick with it a bit. That's why the most important thing is starting with a project you're excited about.

This book will take you from playing around with stats in Excel to scraping websites, building databases and running your own machine learning models.

30 day money back guarantee!

“This book was really, really well done.”

Bill Connelly

Learn How to Do Your Own Football Analysis in Python

You'll learn — step by step and applied to fantasy football — how to program your own analysis. You'll also learn how to make plots like these 👇:

scoring densityairyads vs yacqbs by weekpoints by position and week

☝️ with 2 lines of code!

“Amazingly awesome... the way the learning is framed here is 10x what you'll get someplace else.”


What People Are Saying

About this and the related basketball, baseball, soccer and hockey versions —

“I was amazed by how you broke down complicated concepts and made them easier to understand.”


Get Learn to Code with Fantasy Football

Looking to buy as a gift? —Go here!



Includes book, datasets, example scripts, end of chapter problems with full solutions, and flashcards.

  • The 270 page book in PDF format + files

  • 300+ spaced repetition flash cards

Book + 2023/2024 Dev Kits + Fantasy Math


The book, files and flashcards, plus the . Includes API and Fantasy Math web access for the 2023 and 2024 season.

  • The 270 page book in PDF format + files

  • 300+ spaced repetition flash cards

  • Five step-by-step project guides + final code (250+ pages)

  • 2023/2024 Fantasy Math Simulation API Access

  • 2023/2024 Fantasy Math Web Access

2023 and 2024 Developer Kits

Already own Learn to Code with Fantasy Football and just need the developer kit + API access for 2023? Get it now for $79.


Buy the 2024 Developer Kit and get access for the rest of 2023!

Paypal link here.

30 Day Money Back Guarantee

Try it! If you're not satisified, contact me within 30 days and I'll refund you the purchase price.

“I've taken automate the boring stuff, python for finance, etc and while those course are great... I seem to be understanding it better because its about a subject I like.”


2024 Fantasy Football Developer Kit

A project based guide to help you get better at Python and fantasy football. Analyze your team using state of the art tools that you build.

What We'll Make



Automatic Team & League Import - NEW

We'll write code to pull down player and matchup info from your ESPN, Yahoo, Fleaflicker or Sleeper leagues, learning more about real life APIs, authentication and more along the way.

After that, we'll connect this project to the league analyzer and who do I start calculator projects below for instant analysis.

Who Do I Start Calculator

We'll build a tool that takes in you and your opponents lineup, a list of guys you're thinking about starting and returns the probability of winning with each one.

Access to the 2024 API means you'll be able to use it to help your team this year. And the same, best-in-class simulations Fantasy Math uses means you'll be able to take into account variance and real life correlations among players to start the guy who maximizes your probability of winning.

League Analyzer

We'll build a league analysis tool to get get projections, betting lines, over-under and probability each team gets the high or low. Whether you share the results with your league or keep the intel to yourself is up to you.

Best Ball Projector

Enter in different best ball lineups and get back projected scores, utilization percentages and more. Traditionally, projecting best ball lineups has been difficult/impossible to do with any real accuracy, but working with simulated point projections makes it easy. Plus we'll learn a lot in in the process.

Something New for 2024

I add a project to the kit every year. Last year it was automatic league import (Yahoo, ESPN, Sleeper and Fleaflicker). Have an idea for what you think we should build this year? Feel free to pass it along! I'm open to suggestions.

“I wouldn't be where I'm at with the Python language today without this to book to kick start things.”


Frequently Asked Questions

Do I need any coding experience?

No! Many people have gone through it with zero coding experience and done just fine.

That said, it does move fast and build on itself, so if you're new you might just have to take it slower and make sure you understand each section before continuing. It includes end-of-chapter problems and exercises that you can use to do that, so it's not hard.

Do I need any special software?

We'll learn Python, which is a free, open-source program. Detailed installation instructions are included.

The book includes some optional spaced repetition flashcards to help you remember what you've learned. The official iPhone app to use these costs $25 (it's free on Android). It's worth it IMO, but I describe workarounds if you don't want to pay this.

Can I give this as a gift?

Yes! Go here. You'll be able to enter the recipient's name, email, and when you want the book sent (stroke of midnight, Christmas eve).

Is this book good for kids?

Yes, I've heard of kids as young as 12 working through and liking the book. It doesn't require any prior knowledge, and I explain even relatively simple concepts like "data". That said, it does build on itself and moves pretty quickly, but usually that's good. In general, if you have a smart kid who is into sports, it's not only doable, but fun.

Not sure which sport to get — is there a deal if I buy more than one?

Besides football, I also have basketball, baseball, soccer and hockey versions.

They all teach the same, general purpose data and analysis concepts. For most people, reading just one will be fine. That said, there are some differences, particularly around the where to get data and API chapters.

Additional sports are 50% off. You can find more info and purchase multiple books here.

Can I expense this for work?

Probably! Many people have.

Although you'll learn all these concepts (Python, SQL, data manipulation, visualization, and modeling) via fantasy football, you'll 100% be able to apply these concepts to other areas, including your day job.

This is exactly what I did. I taught myself to code by playing around with fantasy football stats on nights and weekends. Then I used that — without going to school or a bootcamp — to get multiple data science jobs in non-sports fields.

Company/multi license discounts are available too. Email me and I'm happy to help.

Do you offer a physical book?

At the moment the book is only available in an electronic format. This is primarily for two reasons:

  1. It lets me keep it updated. Lifetime updates are included with purchase.
  2. It is meant to be coded along with. Ideally, you would have it up in one monitor and your Python setup on another.

That said, I might make a physical version someday. And I have had some readers take it to a print shop and have them print it out and bind it.

Where do I get the files?

See the prerequisites section of the book. But they're at:

Does this include updates? How do I get them?

Yes! The book includes lifetime updates. If I update the book — whether it's to fix a typo, make a section clearer or because something changed with one of the libraries — I upload the newest version to SendOwl, and reset everyone's number of downloads.

If it's a significant change (e.g. a library has changed or I fixed something that was broken) I'll send an email about it. If it's just a typo, I usually don't in order to avoid clogging email inboxes.

You can follow along with all the changes on GitHub. If you bought the book a while ago and are picking it up, it's a good a idea grab the newest version.

I want to copy/make notes on the text, but it's asking for a password.

The site I use to everything send everything out (SendOwl) password protects it automatically. I've asked them about it but they said it's random and not even they know it.

Me + some readers have figured out a way around it, it just involves some manual work — if it's a problem email me and I'm happy to help.

“I have tons of coding books. Yours is a favorite.”

Craig M

What will you learn?

Python — This flexible language is the foundation of everything from data munging to web scraping to machine learning. You'll also learn about its key data library Pandas, the modeling and machine learning libraries statsmodels and scikit-learn, and how to do data visualizations with seaborn.

Web Scraping and APIs — Next time you run across a site with data you'd like to analyze you'll know how to grab data via its public API if it's available, or build a web scraper to get it yourself if it's not.

Machine Learning and Statistics — You'll learn the difference between a regression and a random forest, and will know when and how to build both.

Databases and SQL — Build your own database — whether it's for player statistics, to keep track of opponent tenancies, etc — and use SQL to get data in and out of it.

All in the context of football and designed so you can learn how to apply them to your own questions and do your own analysis.

About the author


Hi! My name is Nate and I'm a self-taught programmer and data scientist based in Milwaukee, WI.

A few years ago, I didn't know anything about Python, SQL, machine learning, web scraping or any of the other topics covered here.

So, I taught myself. It took a few years and I ran into a lot of dead ends along the way, but ultimately I figured it out. In this book, I distill everything I've learned to provide a step-by-step guide to doing football analytics and get you up and running as quickly as possible.