Package: nfldfs
nfldfsnfldfsis a Python package for NFL daily fantasy sports analysis. It provides an easy interface to scrape data for DraftKings, FanDuel, and Yahoo! fromrotoguru1so that you don't have to.FeaturesInstallationUsageWork with it interactivelyUse the CLI toolFuture WorkFeaturesSearch for data using combinations of season and weekReturn data only for the daily fantasy sites you care aboutWork with results as a pandas DataFrame or use the CLI to output results directly to a.csvInstallationnfldfsis supported for Python 3 can be installed via pip:pipinstallnfldfsor from the repo (which may at times be more up-to-date):# Clone the repogitclonehttps://github.com/BrianDoucet01/nfldfs.gitcdnfldfs
pythonsetup.pyinstallUsageIf you're just looking for a bulk data download, it's recommended that you use theCLItool. It exports results directly to thenfldfs/datadirectory in.csvformat. Head over there to see asampleof DraftKings salary and points data for the entire 2017 season.Here are some quick and dirty examples that illustrate how to work with the package interactively. For more robust examples and a data dictionary, refer to thedocsfolder.Working with the package interactivelySeveral examples to show how you could work with the package directly inIPythonor aJupyter Notebook.Get DraftKings salary and points data for the entire 2019 season.fromnfldfsimportgamesasgames# Scrape DraftKings salary and points data for the entire 2019 seasong=games.find_games('dk',2019,1,2019,17)stats=games.get_game_data(g)type(stats)pandas.core.frame.DataFrame# Confirm there's data for weeks 1-17stats.week.unique()array([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])# Inspect a random sample of 10 rowsstats.sample(10)weekyearplayer_namepositionteam_namehome_or_away\gid5588162019Penny,ElijhaaRBnyga5765112019Spencer,DiontaeWRdena555632019Samuel,CurtisWRcara5790172019Blake,ChristianWRatla5649162019Foster,RobertWRbufa7031122019WashingtonDefwash4675142019Henry,HunterTElaca140332019Dalton,AndyQBcina538632019Lockett,TylerWRseah151972019Trubisky,MitchellQBchihopponent_namepointssalarydfs_sitegid5588was0.003000.0dk5765min0.003000.0dk5556ari16.304800.0dk5790tam0.003000.0dk5649nwe0.003000.0dk7031det21.003000.0dk4675jac11.905100.0dk1403buf18.065300.0dk5386nor35.406200.0dk1519nor20.045100.0dkGet data for DraftKings, FanDuel, and Yahoo! for week 2 of the 2018 season.# Get Yahoo! data for a single week aross multiple seasonsyh=games.find_games(dfs_site='yh',season_from=2018,week_from=1,season_to=2019)weekyearplayer_namepositionteam_namehome_or_away\yeargid2018703012018TennesseeDeftena122512018Manning,EliQBnygh2019153912019Jones,DanielQBnyga542412019Diggs,StefonWRminhopponent_namepointssalarydfs_siteyeargid20187030mia11.0012.0yh1225jac8.1623.0yh20191539dal-0.8220.0yh5424atl4.7025.0yhUsing the CLIThe command line interface (CLI) was designed for those who just want to download the raw data to use elsewhere; be it a database, Excel, Google Sheets, or another program.You run the CLI tool by calling it directly from within the package directory. Results are sent to thenfldfs/datadirectory. Callpython cli.py --helpfor more information on arguments and options.Example using the CLI to produce the DraftKings sampleFuture WorkThis project is being actively worked on. If you'd like to contribute, please Fork the project and submit a Pull Request.Adding more functionality to the CLI toolOptions to preview data before outputFunctions for analysisIncorporating more data:WeatherGame schedules and slates (Main, Sunday Night etc...)Scraping  points and salary data for the current seasonDownloading projections that are available from various sites