
To add the ranking of the defense to every weekly stat file, I had to iterate through all the weeks and all the schedule files to find the opposing team and then add the ranking of the defense to the weekly stat file. The rankings are determined by the average number of fantasy points a defense gives to each position (QB, RB, WR, TE) throughout the year. Once, all the fantasy points were listed for each player in the data files, I needed to pull the defense ranking of the team they played when they scored those points. The next step is to iterate through all the data files and transform all of the stats into PPR fantasy points: fantasypoints = 0 # negative stats fantasypoints -= (stats * 2) fantasypoints -= (stats * 2) # positive stats fantasypoints += (stats * 0.04 fantasypoints += (stats * 4) fantasypoints += (stats * 0.1) fantasypoints += (stats * 6) fantasypoints += (stats * 0.1) fantasypoints += (stats * 6) fantasypoints += (stats)Īfter converting player stats into fantasy points, the data files looked like: Player Name, Position, Team, Games Played, Total Fantasy Points, Average Fantasy Points Todd Gurley,RB,LAR,15.0,383.3,25.55 Le'Veon Bell,RB,PIT,15.0,341.6,22.77 Kareem Hunt,RB,KAN,16.0,295.2,18.45 Alvin Kamara,RB,NOR,16.0,312.4,19.52 Step #3: Pulling Defense Rankings for Each Week The data necessary is the yearly stats for every player, the weekly stats for every week for every player, the rankings of every defense against QBs, RBs, WRs, and TEs, and the schedules for each team from 2017–2019. The first step to any data analysis project is collecting the data. This led me to ask the question: what is the effect of a defense’s strength on the fantasy output of a player? Step #1: Data Collection I wanted to figure out which players were “matchup-proof” and which players were matchup reliant. Some players’ output is heavily reliant on the strength of the defense they play while others are “matchup-proof”, meaning that regardless of the strength of the opposing team, they will perform well. After the fantasy playoffs (weeks 14–16), the champion is crowned.Ī vital part of fantasy football is deciding which players you are starting based on their matchups. After the first 13 weeks, the owners with the most wins make the playoffs and are placed into a bracket. Whoever has the most points scored by their players that week receives a win. The first 13 weeks of the NFL season is known as the fantasy regular season, each week you play in a head to head matchup with another owner in your league. Point Per Reception (PPR): Scoring is the same as Standard, except players get 1 additional point per receptionĪfter the draft, you can add unrostered players to your team or make trades with other owners to improve your team.Standard: 1 point per 25 passing yards, 4 points per passing touchdown, 1 point per 10 rushing or receiving yards, 6 points per rushing or receiving touchdown, -2 points per fumble lost or interception.Auction Draft: each owner gets a set amount of money, and each owner can bid for each player as long as they have a sufficient amount of money.Snake (Traditional) Drafts: each owner gets a chance to draft and the draft order reverses each round of the draft.Dynasty Leagues: each season, owners keep their entire roster for the next season and draft rookies in the draft.Keeper Leagues: each season, owners can keep a certain number of players for the following season, and then draft the rest of their roster.Redraft Leagues: each season, rosters completely reset and all players are available to draft.The bench can be made up of any players the owner chooses. The starting lineup includes a combination of quarterbacks (QB), running Backs (RB), wide Receivers (WR), tight ends (TE), flexes (FLEX), kickers (K), and defenses (D/ST) based on league settings. Each league has two parts to a roster: the starting lineup and the bench. Each member of the league is the owner/general manager of their team. To play fantasy football, you need to create or join a league on one of many websites (ESPN, Yahoo, Sleeper, CBS, NFL, etc). With the 2020–2021 NFL fantasy football season about to come to a close, I was inspired to analyze data from the past few years:īefore I start jumping into the data analysis, here’s a summary of fantasy football so we are all on the same page:
