This page is the continuation of my data scraping and visualization tutorial - part one here.
Let's say we want to see the distribution of fantasy production by position. We could look at the point distribution per position for our dataset, but keep in mind that our dataset contains over 800 fantasy players. Instead, we can decide to only look at the top 20 of each position and look at their averages from that perspective.
Execute the code below to see the different positions that are present in our dataset:
This line of code returns to us a list of 6 positions: ['QB' 'RB' 'DST' 'WR' 'K' 'TE'] . As such, we can expect to have 120 or so entries if we're only looking at the top 20 at each position (the number can be greater if some players are tied for any ranking).
To assign a ranking to a player by their position, run the following snippet.
Executing this snippet creates a positional ranking column called PosRank, which we can use to filter the specific dataset that we want - in this case, we assign every player a PosRank value and plot the point distribution by players of Positional Ranks equal to or below 20 (AKA Top 20).
Here we see an enhanced boxplot by position for the top 20 at each position. We can see that the Quarterback position yields the largest point total on average, with the Running Back position in second place, and the Wide Receiver position in third. It is evident that Defenses/Special Teams (DST) are on par with Kickers (K), and Tight Ends in last place on average. python python tutorial sports
If you're a seasoned fantasy footballer, none of the information above should be a surprise to you - Quarterbacks obviously score the most and TE's are generally a wasteland year in and year out. But it's important to revisit any truths and biases we have to make sure our understanding of any system is valid. For every ten times that we reconfirm something we hold to be true, finding ourselves to be wrong about one thing can be the inefficiency that helps you stay ahead of the competition - in anything, not just fantasy football.
If this type of simple analysis is the type of thing you love to do (like me), I hope this tutorial is the shot of espresso that helps you get started! So much is left to be explored, and in this day and age of the internet, there really isn't any excuse for not being able to do it. Thanks for reading!
Copyright © 2020 Ballgorithms - All Rights Reserved.
Powered by GoDaddy Website Builder