Build an NBA Fantasy Projection Model in Python with PandasUdemy page →
Let me start off by saying that my first love has always been the NBA and my second love is coding. As such, I think this class will be a lot of fun for passionate NBA fans who also happen to be aspiring coders. This is the premier Udemy class out there that uses strictly NBA stats as data to help wrap your head around concepts in the python programming language.
While I have found it helpful to read textbooks and watch online tutorials to get a better understanding of the basics for any subject, nothing beats project-based learning. Actually getting your hands dirty and running into real problems that require specific solutions has been my ideal way to learn something new.
With that being said, the hardest question typically is, what project should I focus on? From my personal experience, I’ve found it beneficial to focus on something you are passionate about. To find that something, just think of what you frequently pay attention to in your spare time, when no one is paying you...to pay attention to it. For me, that something is the NBA. I’m a proud subscriber to League Pass. It didn’t take long for me to realize that using NBA stats was going to be the best way for me to learn how to code.
"For one, sports has served as an entry point to data analysis for many. Sports is interesting and has great data relative to other fields, so it can teach skills and methods of thought that are then more broadly applicable. Personally, I learned how to program, a skill that has been enormously valuable to me, specifically to analyze basketball stats. And I'm far from the only story like this." -Ben Falk, Cleaning The Glass
Using the NBA to learn how to code sounds like a good start, but it it still missing a key piece to turn it into an actual project. That key piece is a goal. Tiago Forte defines a project as, “a series of tasks linked to a goal, with a deadline.”
So what is our goal? Well, for those of you that have played fantasy basketball before, you may have learned how important the draft is. Your team’s success is often times linked directly to your success in the draft. And your success in the draft is often linked to how effectively you can project player stats for that upcoming year. If you know Lebron James is going to score more fantasy points than Anthony Davis then you will want Lebron James on your fantasy team.
After blindly turning to the internet for many consecutive years to use projection models that weren’t made by the oafs at ESPN or Yahoo, it dawned on me that said models had to come from someone’s brain. My thinking from there was, “what’s stopping me from building my own projection model?”
Alas! We have our class project! We are going to build an NBA Fantasy Projection model so you can win your NBA Fantasy League! And how will we do that? By learning to code!
This is another reminder that everything I’ve done to date has been a combination of self-teaching and learning from a friend who also happens to be a talented engineer.
For our purposes, we are going to focus on Python. I’ve been hooked on it ever since I took the class Automate the Boring Stuff with Python. It's undoubtedly a popular programming language so I think it will be beneficial for many years to come.
This class is not meant to be an introduction to programming or python, so my assumption is that you understand some basics. This class is geared more towards helping you apply Python programming to an actual project to help you better retain information while having fun within the process.
Since this class is primarily focused on data (in the form of NBA stats), we will need to manipulate the data in various ways. To help with this, we’ll use the Pandas library. Pandas is extremely powerful and can be used in more ways than just building NBA fantasy projection models so I think you will find it extremely helpful to learn more about.
In his book, Jake VanderPlas describes Pandas as, “a newer package built on top of NumPy, and provides an efficient implementation of a DataFrame. dataFrames are essentially multidimensional arrays with attached row and column labels, and often with heterogeneous types and/or missing data. As well as offering a convenient storage interface for labeled data, Pandas implements a number of powerful data operations familiar to users of both database frameworks and spreadsheet programs.” Said another way, Pandas is SQL and Excel on steroids!
By the end of this course you will be ready to win your NBA fantasy league by building the best fantasy projection model using Python and more specifically Pandas. All of this will be done using a Jupyter Notebook so you can share your work and improve on it over the years.