Intimidating fantasy football names


28-Apr-2015 15:19

First goal accomplished—data collection is now almost entirely automated and will scale from year to year.

Quickly scanning examples and documentation led me to write this code: import nflgame import csv import os #Define a list for every week in the NFL regular season weeks = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17] #For every week in the weeks list, grab the player game logs and create a csv file for each week for week in weeks: nflgame.combine(nflgame.games(2015, week=week)).csv(str(week)+'.csv') #The previous function created an empty row between each row of data.

The function below brings back in every csv, removes the empty rows, and creates new csv files for week in weeks: input = open(str(week)+'.csv', 'rb') output = open('Week'+str(week)+'.csv', 'wb') writer = csv.writer(output) for row in csv.reader(input): if row: writer.writerow(row) input.close() output.close() #Delete unused csv files for week in weeks: os.remove(str(week)+'.csv') Now that we have our data sorted out, we can use Tableau’s Union feature to combine all 17 of our csv files into a single data source.

This process, although successful, involved hours of data collection and resulted in outputs that wouldn’t scale to a greater population.

With those challenges in mind, I wanted to do a few things differently in 2016: If I could give a single suggestion for anyone wanting to work with sports data without hours of copying and pasting, it would be to learn Python.

Do yourself a favor and download Anaconda, which is an open data-science platform powered by Python. My drafting model relies heavily on consistency metrics, which rely heavily on the data more granular than season-long totals.

Like many others, I’ve found that the key to winning in fantasy football is having a team that consistently performs at a high level.

You may take a large loss here or there to high-variance teams, but making the playoffs will be a simple task if your team can consistently score above-average point totals every week.

Last year I gave myself an arduous task of manually collecting and organizing game logs for every offensive player.

Suffice it to say I really didn’t want to spend hours doing this exercise again.

After only a few minutes of searching, I found an NFL data API built for Python named nflgame.



We strongly believe that four minutes is the right amount of time to decide whether you're prepared to invest more time in follow up emails and phone calls to land a real date with someone you meet at one of our events. Alternatively send a cheque or postal order to us at:- What happens when I arrive at the event?… continue reading »


Read more