You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to export all data from a given nfldb query into a CSV file so i can load in Tableau Public - I remember this was possible in nflgame I think.
Could anyone provide an example of how to do this? I'm fairly basic at this stuff.
Appreciate it.
The text was updated successfully, but these errors were encountered:
I dug up a piece of code I wrote a couple of years ago (and for this example changed the year in the query). I am not a programmer and I do not use Python (except by example). I don't even remember where I got this code from (so I apologize to anyone I am copying from without reference).
import nflgame
import nflgame.sched
import csv
schedule_games = nflgame.sched.games
with open("E:\NFLDB 2018 incarnate\\2018 Schedule.csv", 'wb') as csvfile:
schedulewriter = csv.writer(csvfile, delimiter=',')
schedulewriter.writerow(['Key','Home', 'Away', 'Week', 'Year'])
for key in schedule_games:
game = schedule_games[key]
if game['year'] == 2018 and game['season_type'] == 'REG':
schedulewriter.writerow([game['eid'], game['home'], game['away'], game['week'], game['year']])
I'd like to export all data from a given nfldb query into a CSV file so i can load in Tableau Public - I remember this was possible in nflgame I think.
Could anyone provide an example of how to do this? I'm fairly basic at this stuff.
Appreciate it.
The text was updated successfully, but these errors were encountered: