Giter Site home page Giter Site logo

nfl_data_py's Introduction

nfl_data_py

nfl_data_py is a Python library for interacting with NFL data sourced from nflfastR, nfldata, dynastyprocess, and Draft Scout.

Includes import functions for play-by-play data, weekly data, seasonal data, rosters, win totals, scoring lines, officials, draft picks, draft pick values, schedules, team descriptive info, combine results and id mappings across various sites.

Installation

Use the package manager pip to install nfl_data_py.

pip install nfl_data_py

Usage

import nfl_data_py as nfl

Working with play-by-play data

nfl.import_pbp_data(years, columns, downcast=True, cache=False, alt_path=None)

Returns play-by-play data for the years and columns specified

years : required, list of years to pull data for (earliest available is 1999)

columns : optional, list of columns to pull data for

downcast : optional, converts float64 columns to float32, reducing memory usage by ~30%. Will slow down initial load speed ~50%

cache : optional, determines whether to pull pbp data from github repo or local cache generated by nfl.cache_pbp()

alt_path : optional, required if nfl.cache_pbp() is called using an alternate path to the default cache

nfl.see_pbp_cols()

returns list of columns available in play-by-play dataset

Working with weekly data

nfl.import_weekly_data(years, columns, downcast)

Returns weekly data for the years and columns specified

years : required, list of years to pull data for (earliest available is 1999)

columns : optional, list of columns to pull data for

downcast : converts float64 columns to float32, reducing memory usage by ~30%. Will slow down initial load speed ~50%

nfl.see_weekly_cols()

returns list of columns available in weekly dataset

Working with seasonal data

nfl.import_seasonal_data(years, s_type)

Returns seasonal data, including various calculated market share stats specific to receivers

years (List[int]) : required, list of years to pull data for (earliest available is 1999)

s_type (str) : optional (default 'REG') season type to include in average ('ALL','REG','POST')

calculated receiving market share stats include:

Column is short for
tgt_sh target share
ay_sh air yards share
yac_sh yards after catch share
wopr weighted opportunity rating
ry_sh receiving yards share
rtd_sh receiving TDs share
rfd_sh receiving 1st Downs share
rtdfd_sh receiving TDs + 1st Downs share
dom dominator rating
w8dom dominator rating, but weighted in favor of receiving yards over TDs
yptmpa receiving yards per team pass attempt
ppr_sh PPR fantasy points share

Additional data imports

nfl.import_seasonal_rosters(years, columns)

Returns yearly roster information for the seasons specified

years : required, list of years to pull data for (earliest available is 1999)

columns : optional, list of columns to pull data for

nfl.import_weekly_rosters(years, columns)

Returns per-game roster information for the seasons specified

years : required, list of years to pull data for (earliest available is 1999)

columns : optional, list of columns to pull data for

nfl.import_win_totals(years)

Returns win total lines for years specified

years : optional, list of years to pull

nfl.import_sc_lines(years)

Returns scoring lines for years specified

years : optional, list of years to pull

nfl.import_officials(years)

Returns official information by game for the years specified

years : optional, list of years to pull

nfl.import_draft_picks(years)

Returns list of draft picks for the years specified

years : optional, list of years to pull

nfl.import_draft_values()

Returns relative values by generic draft pick according to various popular valuation methods

nfl.import_team_desc()

Returns dataframe with color/logo/etc information for all NFL team

nfl.import_schedules(years)

Returns dataframe with schedule information for years specified

years : required, list of years to pull data for (earliest available is 1999)

nfl.import_combine_data(years, positions)

Returns dataframe with combine results for years and positions specified

years : optional, list or range of years to pull data from

positions : optional, list of positions to be pulled (standard format - WR/QB/RB/etc.)

nfl.import_ids(columns, ids)

Returns dataframe with mapped ids for all players across most major NFL and fantasy football data platforms

columns : optional, list of columns to return

ids : optional, list of ids to return

nfl.import_ngs_data(stat_type, years)

Returns dataframe with specified NGS data

stat_type (str) : required, type of stats to pull (passing, rushing, receiving)

years : optional, list of years to return data for

nfl.import_depth_charts(years)

Returns dataframe with depth chart data

years : optional, list of years to return data for

nfl.import_injuries(years)

Returns dataframe of injury reports

years : optional, list of years to return data for

nfl.import_qbr(years, level, frequency)

Returns dataframe with QBR history

years : optional, years to return data for

level : optional, competition level to return data for, nfl or college, default nfl

frequency : optional, frequency to return data for, weekly or season, default season

nfl.import_seasonal_pfr(s_type, years)

Returns a dataframe of season-aggregated data sourced from players' pages on pro-football-reference.com. E.g. Patrick Mahomes

s_type (str) : required, the type of stat data to request. Must be one of pass, rec, or rush.

years (List[int]) : optional, years to return data for

nfl.import_weekly_pfr(s_type, years)

Returns a dataframe of per-game data sourced from players' advanced gamelog pages on pro-football-reference.com. E.g. Mahomes in 2022

s_type (str) : required, the type of stat data to request. Must be one of pass, rec, or rush.

years (List[int]) : optional, years to return data for

nfl.import_snap_counts(years)

Returns dataframe with snap count records

years : optional, list of years to return data for

nfl.import_ftn_data(years, columns=None, downcast=True, thread_requests=False)

Returns dataframe with FTN charting data

FTN Data manually charts plays and has graciously provided a subset of their charting data to be published via the nflverse. Data is available from the 2022 season onwards and is charted within 48 hours following each game. This data is released under the CC-BY-SA 4.0 Creative Commons license and attribution must be made to FTN Data via nflverse

years (List[int]) : required, years to get weekly data for columns (List[str]) : optional, only return these columns downcast (bool) : optional, convert float64 to float32, default True thread_requests (bool) : optional use thread pool to read files, default False

Additional features

nfl.cache_pbp(years, downcast=True, alt_path=None)

Caches play-by-play data locally to speed up download time. If years specified have already been cached they will be overwritten, so if using in-season must cache 1x per week to catch most recent data

years : required, list or range of years to cache

downcast : optional, converts float64 columns to float32, reducing memory usage by ~30%. Will slow down initial load speed ~50%

alt_path :optional, alternate path to store pbp cache - default is in program created user Local folder

nfl.clean_nfl_data(df)

Runs descriptive data (team name, player name, etc.) through various cleaning processes

df : required, dataframe to be cleaned

Recognition

I'd like to recognize all of Ben Baldwin, Sebastian Carl, and Lee Sharpe for making this data freely available and easy to access. I'd also like to thank Tan Ho, who has been an invaluable resource as I've worked through this project, and Josh Kazan for the resources and assistance he's provided.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

nfl_data_py's People

Contributors

alecglen avatar cooperdff avatar erictruett-dotcom avatar mmuta52 avatar pseminatore avatar sansbacon avatar scottiegarcia avatar throy45 avatar wstrausser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nfl_data_py's Issues

.import_ngs_data() HTTPError when filtering for year(s)

HTTPError: HTTP Error 404: Not Found

I receive a 404: not found error when I try to import ngs data from a specific year:

This works just fine and returns the dataframe:

ngs_data = nfl.import_ngs_data('passing')

ngs_data

When I add a specific year argument, this breaks:

ngs_data = nfl.import_ngs_data('passing', [2020])

ngs_data

Yes: I realize that nfl.import_ngs_data('passing') is comprehensive of all seasons that are available and I can filter with that.

I don't know much about these different file formats, but when I look in nflverse-data/releases/nextgen_stats it looks like there are no .parquet files specific to a season (only .qs, .csv.gz, .rds), only the larger ones (sans season) called in the first block:
Screen Shot 2022-07-26 at 12 12 50 PM

So I think something just needs to be changed around here?

Thanks for putting together this awesome library!! It's been a huge help as I get ready for the season.

Reduce memory usage of multi-year pbp dataframe

If you load 20 years of data into one dataframe, you could start pushing up against memory limits on certain users' computers. You can reduce memory usage about 30% by converting float64 values to float32 when loading the yearly play-by-play data.

cols = df.select_dtypes(include=[np.float64]).columns
df.loc[:, cols] = df.loc[:, cols].astype(np.float32)

On my computer, this reduced the memory usage of a single year from 129.7 MB to 94.5 MB. I don't think the lost precision is going to matter for anything we are doing with football stats.

If you are interested, I can submit a pull request that implements this change. You could also make it optional with the default being to downcast but allow the user to override if they want np.float64 as the dtype.

import_weekly_data returns shortened list

I am trying to get a list of player ids with name and position. When I use the following

player = nfl.import_weekly_data([2023], ['player_id', 'player_name','position'],downcast=False)
print(player)

It outputs

   player_id   player_name position

0 00-0023459 A.Rodgers QB
1 00-0024243 M.Lewis TE
2 00-0026498 M.Stafford QB
3 00-0026498 M.Stafford QB
4 00-0026498 M.Stafford QB
... ... ... ...
1235 00-0039164 A.Richardson QB
1236 00-0039164 A.Richardson QB
1237 00-0039165 Z.Charbonnet RB
1238 00-0039165 Z.Charbonnet RB
1239 00-0039165 Z.Charbonnet RB

I would like to output all 1239( Rather ALL) Player IDs with stats to a file. I didn't see any other issues reported so I Know I'm doing something wrong, can anyone point me in the right direction?

Caching does not work for Unix file systems

The cache setup is a great new improvement! I just went to give it a try but encountered issues on my Ubuntu machine.

The problem is with the hard-coded backslashes in cache_pbp and import_pbp_data, e.g. https://github.com/cooperdff/nfl_data_py/blob/62b6127d94d5c7c69045470ea04bca902b697b58/nfl_data_py/__init__.py#L81
For Linux and MacOS, the \\ needs to be a forward slash instead.

Similar to appdirs, the os module has all the magic needed to do this cleanly - specifically os.path.join(). I can open a PR for it this weekend if no one beats me to it.

Help - Novice here

I'm trying to pull in some data from nfl_data_py and get the following error message. Same happens for any year I include. I did a pip install and verified the package is loaded. - thanks

screenshot python code

import_seasonal_data() concatenating column values

When I run the import_seasonal_data() column it duplicates column names:

nfl_df = nfl.import_seasonal_data([2022])
nfl_df['player_name'].value_counts()

player_name
T.BradyT.BradyT.BradyT.BradyT.BradyT.BradyT.BradyT.BradyT.BradyT.BradyT.BradyT.BradyT.BradyT.BradyT.BradyT.BradyT.Brady 1

Perhaps some kind of summation/concatenation to get to the season level is causing this duplication?

import_pbp_data function not working

when trying to run the function import_pbp_data, I receive the following error message: No such file or directory: [path]

Code:
import nfl_data_py as nfl data = nfl.import_pbp_data([2021])

Screen Shot 2021-09-21 at 5 41 50 PM

Missing EPA data

In week 6 of 2021, the Chicago Bears lost 24-14 to the Green Bay Packers: https://www.nfl.com/games/packers-at-bears-2021-reg-6. When trying to load the EPA data for this game, I get an empty dataframe. Could someone let me know if I am doing something wrong?

import nfl_data_py as nfl

seasons = [2021]
cols = ['epa', 'week', 'possession_team']

nfl.cache_pbp(seasons, downcast=True, alt_path=None)
data = nfl.import_pbp_data(seasons, cols, cache=True)

print(data.loc[(data['possession_team'] == 'CHI') & (data['week'] == 5)])
print(data.loc[(data['possession_team'] == 'CHI') & (data['week'] == 6)])

Pandas version incompatibility

Per discussion in nflverse discord.

Release 0.2.7 updated Pandas to a version not compatible with Python 3.6. This requirement should be reverted if possible. Alternatively if functionality in the updated Pandas is found to be needed, then the package metadata should be updated to specify it requires Python >= 3.7.

import_combine_data() breaks with positions and no years param

There's a bad column reference in the function "positions" instead of "pos". The current tests don't catch it because it's inside a control block that only gets hit when the function is called without a years arg and with a positions arg.

>>> nfl.import_combine_data(positions=["QB"])

Traceback (most recent call last):
  File "/Users/alecostrander/opt/anaconda3/envs/ndp/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3653, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas/_libs/index.pyx", line 147, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 176, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'position'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/alecostrander/tutorials/nfl_data_py/nfl_data_py/__init__.py", line 603, in import_combine_data
    df = df[df['position'].isin(positions)]
  File "/Users/alecostrander/opt/anaconda3/envs/ndp/lib/python3.9/site-packages/pandas/core/frame.py", line 3761, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/Users/alecostrander/opt/anaconda3/envs/ndp/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3655, in get_loc
    raise KeyError(key) from err
KeyError: 'position'

Missing Personnel Data Week 4 NFL

It appears that the values for formation data (offense/defense), players on the play (offense/defense), men in the box, # of pass rushers, etc. are unavailable for 2022 Week 4 data (which is otherwise available). Is this a known issue, an intentional omission, or something else? Where is this data sourced from?

Wondering if it will be available in the near future or if that is a result of an availability issue

ID Tables Small Issue?

Hi, i'm a newb and this is my first issue post so please delete if this is wrong. I suspect your code is fine and that the source data has some bugs, but i'm not sure who to alert to help them out.

I believe there are some slight data issues on the player ID table.

probably some more than listed below, but i have to run for now. these are pretty small things, doubtful they will be relevant to anything imminent for anyone... i ran into it on a merge i was doing on gsis_id that didn't like my many-to-one relationship because of it. i'm happy to share and/or try to help fix if manual edits are an option (i stink at coding though)

gsis_id has four duplications: 00-0020270, 00-0019641, 00-0016098, and 00-0029435.
On further research, each of these same cases also has a duplication of the pff_id.
There are no other pff_id duplications.

espn_ids have some duplication: 17257, 2578554, 2574009, 5774, 5730, 12771, 2516049, 13490, 2574010, 14660, 2582138, 16094, 17101. i'm not sure the source of all of these - some seem to be extremely similar names but different people and others seem to be typos (e.g. 5774 one of them should simply be 15774).

yahoo_ids have one dup: 33495. the one from Duke should be 33542

Separate import_pfr into weekly and seasonal methods

Currently, import_pfr() returns one of two nflfastR datasets:

  1. /pfr_advstats/advstats_season_{stat_type} if a years list is not passed
  2. /pfr_advstats/advstats_season_{stat_type}_{year} if a years list is passed

Although they're organized under the same release, these files are generated from different PFR pages and the columns are not quite aligned. This can lead to confusion a la #50 (comment).

I suggest that we break import_pfr into two endpoints: import_seasonal_pfr(s_type, years) and import_weekly_pfr(s_type, years). Doing that will help make the distinction more clear (and we can link to example PFR pages per method to help even more).

import_pfr_passing

Hi, does this module work? I received an error: module 'nfl_data_py' has no attribute 'import_pfr_passing'.

looking for RPO info and I believe this has it?

thank you!
b

Missing 2022 Rookie Data in Roster Import

Hello,

I've been using the nfl_data_py package for a project and have encountered an issue with the 2022 rookie data. Specifically, when I use the import_rosters() function to import rosters for the 2022 season, I've noticed that some rookies, such as Drake London, are missing from the dataset.

Here's the code I've been using:

!pip install nfl_data_py==0.3.0
import nfl_data_py as nfl

# Import player stats from 2020 to 2022
stats = nfl.import_seasonal_data([2020,2021,2022])
stats['season'] = stats['season'] +1

# Import the roster data for 2021 and 2022
seasons = np.arange(2021,2023).tolist()
for year in seasons:
    player_data = nfl.import_rosters([year])

# Merge the stats and player data
nflpy = pd.merge(stats, player_data, how='inner', on=['season','player_id'],suffixes = (None, '_y'))

# Check for Drake London
drake_london = nflpy.query('name == "Drake London"')
print(drake_london)

When I run this code, the drake_london DataFrame is empty, indicating that Drake London's data is not in the 2022 roster data.

I've checked the package documentation and haven't found any information about this issue. I'm using the latest version of the package.

Could you please look into this issue? Is there something I'm missing, or is the 2022 rookie data not yet available in the package's data repository?

Thank you for your help.

Pandas .append method deprication

nfl.import_pbp_data give the warning below. Should update method to use concat rather than append method.

FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
plays = plays.append(raw)

[question] NFL Data Update Schedule

Hello! I'd like to use the NFL data for weekly game statistics. When is this data updated? For instance, when can I access the play-by-play for Week 1 of the 2023 season? I couldn't find this info elsewhere. Thank you very much in advance!

weekly pfr and ftn data

hey,

getting attribute errors when trying to pull down the weekly pfr and ftn data

AttributeError: module 'nfl_data_py' has no attribute 'import_weekly_pfr'
AttributeError: module 'nfl_data_py' has no attribute 'import_ftn_data'

thoughts?
thanks

import_sc_lines only updated to 2020

I can't pull game lines data from past 2020, looking to pull future data if possible...
Input:
if __name__ == "__main__": lines = nfl.import_sc_lines() print(lines.head)
Output
`root@localhost:~# python3 ~/nfl_picks/init.py
<bound method NDFrame.head of season week away_team home_team game_id side line
0 2013 1 BAL DEN 2013090500 BAL 7.5
1 2013 1 BAL DEN 2013090500 DEN -7.5
2 2013 1 NE BUF 2013090800 BUF 9.5
3 2013 1 NE BUF 2013090800 NE -9.5
4 2013 1 SEA CAR 2013090801 CAR 3.5
... ... ... ... ... ... ... ...
4087 2020 17 JAX IND 2021010313 JAX 14.0
4088 2020 17 ARI LA 2021010314 ARI -2.5
4089 2020 17 ARI LA 2021010314 LA 2.5
4090 2020 17 SEA SF 2021010315 SEA -6.0
4091 2020 17 SEA SF 2021010315 SF 6.0

[4092 rows x 7 columns]>
done`

Unable to import data

I am trying to run
`
import nfl_data_py as nfl

nfl.import_seasonal_data([2010])
`

but I get the following error:
OverflowError: value too large
Exception ignored in: 'fastparquet.cencoding.read_bitpacked'

I have tried uninstalling and reinstalling fastparquet, which did not work, and the same issue has arisen in my other function calls.

More specifically:
line 530, in read_col part[defi == max_defi] = dic[val]

IndexError: index 8389024 is out of bounds for axis 0 with size 94518

import_win_totals() years not optional

Git ReadMe and PyPl docs say years is optional, but years is required. This is a bit difficult because all years are not in the data, so it's hard to know why 2022 doesn't show.

Suggest making argument years=None and adding the following in the method/lambda:
if years is None:
years = []

Let me know how I can contribute.
--David

Documentation incorrect on pypi

Hi, thanks for making/maintaining this repo. On the documentation pypi page I noticed a minor mistake for nfl.import_ngs_data(stat_type, years): it says columns : required, type of data (passing, rushing, receiving) but it should probably say stat_type (str): type of stats to pull (receiving, passing, rushing) or something along those lines.

Depth Chart Issues

I noticed that the depth charts data seems to indicate that Desmond Ridder started for the Falcons in week 16 vs. the Colts. However, the Falcons official website has Taylor Heinicke starting. Taylor Heinicke also received all the passing stats for that week. Not sure if this issue shows up anywhere else yet.
image

Indexing Issue With import_weekly_rosters

When trying to import weekly rosters I keep running into this error:

roster_data = nfl.import_weekly_rosters(years=range(2013, 2024))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/nfl_data_py/__init__.py", line 474, in import_weekly_rosters
    rosters["age"] = ((roster_dates - rosters.birth_date).dt.days / 365.25).round(3)
    ~~~~~~~^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandas/core/frame.py", line 4091, in __setitem__
    self._set_item(key, value)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandas/core/frame.py", line 4300, in _set_item
    value, refs = self._sanitize_column(value)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandas/core/frame.py", line 5036, in _sanitize_column
    return _reindex_for_setitem(value, self.index)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandas/core/frame.py", line 12309, in _reindex_for_setitem
    raise err
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandas/core/frame.py", line 12304, in _reindex_for_setitem
    reindexed_value = value.reindex(index)._values
                      ^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandas/core/series.py", line 4977, in reindex
    return super().reindex(
           ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandas/core/generic.py", line 5521, in reindex
    return self._reindex_axes(
           ^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandas/core/generic.py", line 5544, in _reindex_axes
    new_index, indexer = ax.reindex(
                         ^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandas/core/indexes/base.py", line 4433, in reindex
    raise ValueError("cannot reindex on an axis with duplicate labels")
ValueError: cannot reindex on an axis with duplicate labels

AttributeError: 'NotebookFormatter' object has no attribute 'get_result' when running nfl.import_pbp_data

Hey y'all,

I recently installed nfl_data_py. I tried running:

nfl.import_pbp_data(years=[2022], columns=None, downcast=True, cache=False, alt_path=None)

and I received the following error:

AttributeError: 'NotebookFormatter' object has no attribute 'get_result'

This is the full error:

2022 done.
Downcasting floats.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~/opt/anaconda3/lib/python3.8/site-packages/IPython/core/formatters.py in __call__(self, obj)
    343             method = get_real_method(obj, self.print_method)
    344             if method is not None:
--> 345                 return method()
    346             return None
    347         else:

~/opt/anaconda3/lib/python3.8/site-packages/pandas/core/frame.py in _repr_html_(self)
    796                 ]
    797                 mgr = arrays_to_mgr(values, columns, index, dtype=None, typ=manager)
--> 798             else:
    799                 arr2d = construct_2d_arraylike_from_scalar(
    800                     data,

~/opt/anaconda3/lib/python3.8/site-packages/pandas/io/formats/format.py in to_html(self, buf, encoding, classes, notebook, border)
    986 
    987         adjoined = self.adj.adjoin(1, *fmt_index).split("\n")
--> 988 
    989         # empty space for columns
    990         if self.show_col_idx_names:

AttributeError: 'NotebookFormatter' object has no attribute 'get_result'

       play_id          game_id old_game_id home_team away_team season_type  \
0          1.0  2022_01_BAL_NYJ  2022091107       NYJ       BAL         REG   
1         43.0  2022_01_BAL_NYJ  2022091107       NYJ       BAL         REG   
2         68.0  2022_01_BAL_NYJ  2022091107       NYJ       BAL         REG   
3         89.0  2022_01_BAL_NYJ  2022091107       NYJ       BAL         REG   
4        115.0  2022_01_BAL_NYJ  2022091107       NYJ       BAL         REG   
...        ...              ...         ...       ...       ...         ...   
49626   3535.0  2022_20_NYG_PHI  2023012102       PHI       NYG        POST   
49627   3559.0  2022_20_NYG_PHI  2023012102       PHI       NYG        POST   
49628   3604.0  2022_20_NYG_PHI  2023012102       PHI       NYG        POST   
49629   3593.0  2022_20_NYG_PHI  2023012102       PHI       NYG        POST   
49630   3624.0  2022_20_NYG_PHI  2023012102       PHI       NYG        POST   

       week posteam posteam_type defteam  ... offense_formation  \
0         1    None         None    None  ...              None   
1         1     NYJ         home     BAL  ...              None   
2         1     NYJ         home     BAL  ...        SINGLEBACK   
3         1     NYJ         home     BAL  ...           SHOTGUN   
4         1     NYJ         home     BAL  ...        SINGLEBACK   
...     ...     ...          ...     ...  ...               ...   
49626    20     NYG         away     PHI  ...               NaN   
49627    20     NYG         away     PHI  ...               NaN   
49628    20    None         None    None  ...               NaN   
49629    20     NYG         away     PHI  ...               NaN   
49630    20    None         None    None  ...               NaN   

       offense_personnel defenders_in_box  defense_personnel  \
0                   None             <NA>               None   
1                   None             <NA>               None   
2       1 RB, 2 TE, 2 WR                7   3 DL, 4 LB, 4 DB   
3       1 RB, 2 TE, 2 WR                6   3 DL, 4 LB, 4 DB   
4       1 RB, 2 TE, 2 WR                7   3 DL, 4 LB, 4 DB   
...                  ...              ...                ...   
49626                NaN             <NA>                NaN   
49627                NaN             <NA>                NaN   
49628                NaN             <NA>                NaN   
49629                NaN             <NA>                NaN   
49630                NaN             <NA>                NaN   

       number_of_pass_rushers  \
0                        <NA>   
1                        <NA>   
2                        <NA>   
3                           4   
4                        <NA>   
...                       ...   
49626                    <NA>   
49627                    <NA>   
49628                    <NA>   
49629                    <NA>   
49630                    <NA>   

                                         players_on_play  \
0                                                          
1      47969;53059;42500;46279;53575;48364;46253;5460...   
2      53536;43586;53443;42371;42500;44999;43433;3309...   
3      53536;43586;42371;53443;42500;44999;43433;3309...   
4      53536;43586;53443;42371;42500;44999;43433;3309...   
...                                                  ...   
49626                                                NaN   
49627                                                NaN   
49628                                                NaN   
49629                                                NaN   
49630                                                NaN   

                                         offense_players  \
0                                                          
1      00-0036157;00-0035202;00-0037984;00-0029597;00...   
2      00-0036924;00-0032466;00-0036979;00-0032234;00...   
3      00-0036924;00-0032466;00-0032234;00-0036979;00...   
4      00-0036924;00-0032466;00-0036979;00-0032234;00...   
...                                                  ...   
49626                                                NaN   
49627                                                NaN   
49628                                                NaN   
49629                                                NaN   
49630                                                NaN   

                                         defense_players  n_offense  n_defense  
0                                                               0.0        0.0  
1      00-0035537;00-0032134;00-0034419;00-0036500;00...       11.0       11.0  
2      00-0033294;00-0026190;00-0032574;00-0028278;00...       11.0       11.0  
3      00-0033294;00-0026190;00-0032574;00-0028278;00...       11.0       11.0  
4      00-0033294;00-0026190;00-0032574;00-0028278;00...       11.0       11.0  
...                                                  ...        ...        ...  
49626                                                NaN        NaN        NaN  
49627                                                NaN        NaN        NaN  
49628                                                NaN        NaN        NaN  
49629                                                NaN        NaN        NaN  
49630                                                NaN        NaN        NaN  

[49631 rows x 384 columns]

These are the list of packages I have installed:

# packages in environment at /Users/dan.falkenheim/opt/anaconda3:
#
# Name                    Version                   Build  Channel
_anaconda_depends         2020.07                  py38_0  
_ipyw_jlab_nb_ext_conf    0.1.0                    py38_0  
_py-xgboost-mutex         2.0                       cpu_0    conda-forge
absl-py                   1.3.0                    pypi_0    pypi
alabaster                 0.7.12                     py_0  
anaconda                  custom                   py38_1  
anaconda-client           1.7.2                    py38_0  
anaconda-navigator        1.10.0                   py38_0  
anaconda-project          0.8.4                      py_0  
appdirs                   1.4.4                    pypi_0    pypi
applaunchservices         0.2.1                      py_0  
appnope                   0.1.0                 py38_1001  
appscript                 1.1.1            py38haf1e3a3_0  
argh                      0.26.2                   py38_0  
argon2-cffi               20.1.0           py38haf1e3a3_1  
asn1crypto                1.4.0                      py_0  
astroid                   2.4.2                    py38_0  
astropy                   4.0.2            py38haf1e3a3_0  
astunparse                1.6.3                    pypi_0    pypi
async_generator           1.10                       py_0  
atomicwrites              1.4.0                      py_0  
attrs                     20.3.0             pyhd3eb1b0_0  
autopep8                  1.5.4                      py_0  
babel                     2.8.1              pyhd3eb1b0_0  
backcall                  0.2.0                      py_0  
backports                 1.0                        py_2  
backports.functools_lru_cache 1.6.4              pyhd3eb1b0_0  
backports.shutil_get_terminal_size 1.0.0                    py38_2  
backports.tempfile        1.0                pyhd3eb1b0_1  
backports.weakref         1.0.post1                  py_1  
beautifulsoup4            4.9.3              pyhb0f4dca_0  
bitarray                  1.6.1            py38h9ed2024_0  
bkcharts                  0.2                      py38_0  
blas                      1.0                         mkl  
bleach                    3.2.1                      py_0  
blosc                     1.20.1               hab81aa3_0  
bokeh                     2.2.3                    py38_0  
boto                      2.49.0                   py38_0  
bottleneck                1.3.2            py38hf1fa96c_1  
brotlipy                  0.7.0           py38haf1e3a3_1000  
bs4                       4.9.3                hd3eb1b0_0  
bzip2                     1.0.8                h1de35cc_0  
ca-certificates           2022.12.7            h033912b_0    conda-forge
cachetools                5.2.0                    pypi_0    pypi
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.14.3           py38hed5b41f_0  
chardet                   3.0.4                 py38_1003  
chart-studio              1.1.0                    pypi_0    pypi
click                     7.1.2                      py_0  
cloudpickle               1.6.0                      py_0  
clyent                    1.2.2                    py38_1  
colorama                  0.4.4                      py_0  
colorlover                0.3.0                    pypi_0    pypi
conda                     4.14.0           py38h50d1736_0    conda-forge
conda-build               3.20.5                   py38_1  
conda-env                 2.6.0                         1  
conda-package-handling    1.8.1            py38hca72f7f_0  
conda-verify              3.4.2                      py_1  
contextlib2               0.6.0.post1                py_0  
cramjam                   2.6.2                    pypi_0    pypi
cryptography              3.1.1            py38hddc9c9b_0  
cufflinks                 0.17.3                   pypi_0    pypi
curl                      7.71.1               hb0a8c7a_1  
cycler                    0.10.0                   py38_0  
cython                    0.29.21          py38hb1e8313_0  
cytoolz                   0.11.0           py38haf1e3a3_0  
dask                      2.30.0                     py_0  
dask-core                 2.30.0                     py_0  
dbus                      1.13.18              h18a8e69_0  
decorator                 4.4.2                      py_0  
defusedxml                0.6.0                      py_0  
diff-match-patch          20200713                   py_0  
distributed               2.30.1           py38hecd8cb5_0  
docutils                  0.16                     py38_1  
entrypoints               0.3                      py38_0  
et_xmlfile                1.0.1                   py_1001  
expat                     2.2.10               hb1e8313_2  
fastcache                 1.1.0            py38h1de35cc_0  
fastparquet               2023.1.0                 pypi_0    pypi
filelock                  3.0.12                     py_0  
flake8                    3.8.4                      py_0  
flask                     1.1.2                      py_0  
flatbuffers               22.10.26                 pypi_0    pypi
freetype                  2.10.4               ha233b18_0  
fsspec                    0.8.3                      py_0  
future                    0.18.2                   py38_1  
gast                      0.4.0                    pypi_0    pypi
get_terminal_size         1.0.0                h7520d66_0  
gettext                   0.19.8.1             hb0f4f8b_2  
gevent                    20.9.0           py38haf1e3a3_0  
glib                      2.66.1               h9bbe63b_0  
glob2                     0.7                        py_0  
gmp                       6.1.2                hb37e062_1  
gmpy2                     2.0.8            py38h6ef4df4_3  
google-auth               2.14.1                   pypi_0    pypi
google-auth-oauthlib      0.4.6                    pypi_0    pypi
google-pasta              0.2.0                    pypi_0    pypi
greenlet                  0.4.17           py38haf1e3a3_0  
grpcio                    1.50.0                   pypi_0    pypi
h5py                      2.10.0           py38h3134771_0  
hdf5                      1.10.4               hfa1e0ec_0  
heapdict                  1.0.1                      py_0  
html5lib                  1.1                pyhd3eb1b0_0  
icu                       58.2                 h0a44026_3  
idna                      2.10                       py_0  
imageio                   2.9.0                      py_0  
imagesize                 1.2.0                      py_0  
importlib-metadata        5.0.0                    pypi_0    pypi
importlib_metadata        2.0.0                         1  
iniconfig                 1.1.1                      py_0  
intel-openmp              2019.4                      233  
intervaltree              3.1.0                      py_0  
ipykernel                 5.3.4            py38h5ca1d4c_0  
ipython                   7.19.0           py38h01d92e1_0  
ipython_genutils          0.2.0                    py38_0  
ipywidgets                7.5.1                      py_1  
isort                     5.6.4                      py_0  
itsdangerous              1.1.0                      py_0  
jbig                      2.1                  h4d881f8_0  
jdcal                     1.4.1                      py_0  
jedi                      0.17.1                   py38_0  
jinja2                    2.11.2                     py_0  
joblib                    0.17.0                     py_0  
jpeg                      9b                   he5867d9_2  
json5                     0.9.5                      py_0  
jsonschema                3.2.0                      py_2  
jupyter                   1.0.0                    py38_7  
jupyter_client            6.1.7                      py_0  
jupyter_console           6.2.0                      py_0  
jupyter_core              4.6.3                    py38_0  
jupyterlab                2.2.6                      py_0  
jupyterlab_pygments       0.1.2                      py_0  
jupyterlab_server         1.2.0                      py_0  
keras                     2.10.0                   pypi_0    pypi
keras-preprocessing       1.1.2                    pypi_0    pypi
keyring                   21.4.0                   py38_1  
kiwisolver                1.3.0            py38h23ab428_0  
krb5                      1.18.2               h75d18d8_0  
lazy-object-proxy         1.4.3            py38h1de35cc_0  
lcms2                     2.11                 h92f6f08_0  
libarchive                3.4.2                haa3ed63_0  
libclang                  14.0.6                   pypi_0    pypi
libcurl                   7.71.1               h8a08a2b_1  
libcxx                    14.0.6               hccf4f1f_0    conda-forge
libedit                   3.1.20191231         h1de35cc_1  
libffi                    3.3                  hb1e8313_2  
libgfortran               3.0.1                h93005f0_2  
libiconv                  1.16                 h1de35cc_0  
liblief                   0.10.1               h0a44026_0  
libllvm10                 10.0.1               h76017ad_5  
libllvm9                  9.0.1                h21ff451_1  
libpng                    1.6.37               ha441bb4_0  
libsodium                 1.0.18               h1de35cc_0  
libspatialindex           1.9.3                h0a44026_0  
libssh2                   1.9.0                ha12b0ac_1  
libtiff                   4.1.0                hcb84e12_1  
libxgboost                1.7.1            cpu_h0c1cf5f_0    conda-forge
libxml2                   2.9.10               h7cdb67c_3  
libxslt                   1.1.34               h83b36ba_0  
llvm-openmp               15.0.7               h61d9ccf_0    conda-forge
llvmlite                  0.34.0           py38h739e7dc_4  
locket                    0.2.0                    py38_1  
lxml                      4.6.1            py38h63b7cb6_0  
lz4-c                     1.9.2                h79c402e_3  
lzo                       2.10                 haf1e3a3_2  
markdown                  3.4.1                    pypi_0    pypi
markupsafe                1.1.1            py38h1de35cc_1  
matplotlib                3.3.2                         0  
matplotlib-base           3.3.2            py38h181983e_0  
mccabe                    0.6.1                    py38_1  
mistune                   0.8.4           py38h1de35cc_1001  
mkl                       2019.4                      233  
mkl-service               2.3.0            py38hfbe908c_0  
mkl_fft                   1.2.0            py38hc64f4ea_0  
mkl_random                1.1.1            py38h959d312_0  
mock                      4.0.2                      py_0  
more-itertools            8.6.0              pyhd3eb1b0_0  
mpc                       1.1.0                h6ef4df4_1  
mpfr                      4.0.2                h9066e36_1  
mpmath                    1.1.0                    py38_0  
msgpack-python            1.0.0            py38h04f5b5a_1  
multipledispatch          0.6.0                    py38_0  
navigator-updater         0.2.1                    py38_1  
nbclient                  0.5.1                      py_0  
nbconvert                 6.0.7                    py38_0  
nbformat                  5.0.8                      py_0  
ncurses                   6.2                  h0a44026_1  
nest-asyncio              1.4.2              pyhd3eb1b0_0  
networkx                  2.5                        py_0  
nfl-data-py               0.3.0                    pypi_0    pypi
nltk                      3.5                        py_0  
nose                      1.3.7                 py38_1004  
notebook                  6.1.4                    py38_0  
numba                     0.51.2           py38h6440ff4_1  
numexpr                   2.7.1            py38hce01a72_0  
numpy                     1.23.4                   pypi_0    pypi
numpydoc                  1.1.0              pyhd3eb1b0_1  
oauthlib                  3.2.2                    pypi_0    pypi
olefile                   0.46                       py_0  
openpyxl                  3.0.5                      py_0  
openssl                   1.1.1s               hfd90126_1    conda-forge
opt-einsum                3.3.0                    pypi_0    pypi
packaging                 20.4                       py_0  
pandas                    1.5.3                    pypi_0    pypi
pandas-datareader         0.10.0                   pypi_0    pypi
pandoc                    2.11                 h0dc7051_0  
pandocfilters             1.4.3            py38hecd8cb5_1  
parso                     0.7.0                      py_0  
partd                     1.1.0                      py_0  
path                      15.0.0                   py38_0  
path.py                   12.5.0                        0  
pathlib2                  2.3.5                    py38_1  
pathtools                 0.1.2                      py_1  
patsy                     0.5.1                    py38_0  
pcre                      8.44                 hb1e8313_0  
pep8                      1.7.1                    py38_0  
pexpect                   4.8.0                    py38_1  
pickleshare               0.7.5                 py38_1001  
pillow                    8.0.1            py38h5270095_0  
pip                       22.3.1                   pypi_0    pypi
pkginfo                   1.6.1            py38hecd8cb5_0  
plotly                    5.9.0                    pypi_0    pypi
pluggy                    0.13.1                   py38_0  
ply                       3.11                     py38_0  
prometheus_client         0.8.0                      py_0  
prompt-toolkit            3.0.8                      py_0  
prompt_toolkit            3.0.8                         0  
protobuf                  3.19.6                   pypi_0    pypi
psutil                    5.7.2            py38haf1e3a3_0  
ptyprocess                0.6.0                    py38_0  
py                        1.9.0                      py_0  
py-lief                   0.10.1           py38haf313ee_0  
py-xgboost                1.7.1           cpu_py38he866dac_0    conda-forge
pyasn1                    0.4.8                    pypi_0    pypi
pyasn1-modules            0.2.8                    pypi_0    pypi
pycodestyle               2.6.0                      py_0  
pycosat                   0.6.3            py38h1de35cc_1  
pycparser                 2.20                       py_2  
pycurl                    7.43.0.6         py38hddc9c9b_0  
pydocstyle                5.1.1                      py_0  
pyflakes                  2.2.0                      py_0  
pygments                  2.7.2              pyhd3eb1b0_0  
pylint                    2.6.0                    py38_0  
pyodbc                    4.0.30           py38h0a44026_0  
pyopenssl                 19.1.0                     py_1  
pyparsing                 2.4.7                      py_0  
pypdf2                    1.27.12                  pypi_0    pypi
pyqt                      5.9.2            py38h655552a_2  
pyrsistent                0.17.3           py38haf1e3a3_0  
pysocks                   1.7.1                    py38_1  
pytables                  3.6.1            py38h4727e94_0  
pytest                    6.1.1                    py38_0  
python                    3.8.5                h26836e1_1  
python-dateutil           2.8.1                      py_0  
python-jsonrpc-server     0.4.0                      py_0  
python-language-server    0.35.1                     py_0  
python-libarchive-c       2.9                        py_0  
python-snappy             0.6.1                    pypi_0    pypi
python.app                2                       py38_10  
python_abi                3.8                      2_cp38    conda-forge
pytz                      2020.1                     py_0  
pywavelets                1.1.1            py38haf1e3a3_2  
pyyaml                    5.3.1            py38haf1e3a3_1  
pyzmq                     19.0.2           py38hb1e8313_1  
qdarkstyle                2.8.1                      py_0  
qt                        5.9.7                h468cd18_1  
qtawesome                 1.0.1                      py_0  
qtconsole                 4.7.7                      py_0  
qtpy                      1.9.0                      py_0  
readline                  8.0                  h1de35cc_0  
regex                     2020.10.15       py38haf1e3a3_0  
requests                  2.24.0                     py_0  
requests-oauthlib         1.3.1                    pypi_0    pypi
retrying                  1.3.3                    pypi_0    pypi
ripgrep                   12.1.1                        0  
rope                      0.18.0                     py_0  
rsa                       4.9                      pypi_0    pypi
rtree                     0.9.4                    py38_1  
ruamel_yaml               0.15.87          py38haf1e3a3_1  
scikit-image              0.17.2           py38h81aa140_0  
scikit-learn              0.23.2           py38h959d312_0  
scipy                     1.5.2            py38h2515648_0  
seaborn                   0.11.2             pyhd3eb1b0_0  
send2trash                1.5.0                    py38_0  
setuptools                66.1.1                   pypi_0    pypi
simplegeneric             0.8.1                    py38_2  
singledispatch            3.4.0.3                 py_1001  
sip                       4.19.8           py38h0a44026_0  
six                       1.15.0           py38hecd8cb5_0  
snappy                    1.1.8                hb1e8313_0  
snowballstemmer           2.0.0                      py_0  
sortedcollections         1.2.1                      py_0  
sortedcontainers          2.2.2                      py_0  
soupsieve                 2.0.1                      py_0  
sphinx                    3.2.1                      py_0  
sphinxcontrib             1.0                      py38_1  
sphinxcontrib-applehelp   1.0.2                      py_0  
sphinxcontrib-devhelp     1.0.2                      py_0  
sphinxcontrib-htmlhelp    1.0.3                      py_0  
sphinxcontrib-jsmath      1.0.1                      py_0  
sphinxcontrib-qthelp      1.0.3                      py_0  
sphinxcontrib-serializinghtml 1.1.4                      py_0  
sphinxcontrib-websupport  1.2.4                      py_0  
spyder                    4.1.5                    py38_0  
spyder-kernels            1.9.4                    py38_0  
sqlalchemy                1.3.20           py38h9ed2024_0  
sqlite                    3.33.0               hffcf06c_0  
statsmodels               0.12.0           py38haf1e3a3_0  
sympy                     1.6.2            py38hecd8cb5_1  
tbb                       2021.3.0             hf7b0b51_0  
tblib                     1.7.0                      py_0  
tenacity                  8.0.1                    pypi_0    pypi
tensorboard               2.10.1                   pypi_0    pypi
tensorboard-data-server   0.6.1                    pypi_0    pypi
tensorboard-plugin-wit    1.8.1                    pypi_0    pypi
tensorflow                2.10.1                   pypi_0    pypi
tensorflow-estimator      2.10.0                   pypi_0    pypi
tensorflow-io-gcs-filesystem 0.27.0                   pypi_0    pypi
termcolor                 2.1.0                    pypi_0    pypi
terminado                 0.9.1                    py38_0  
testpath                  0.4.4                      py_0  
threadpoolctl             2.1.0              pyh5ca1d4c_0  
thrift                    0.16.0                   pypi_0    pypi
tifffile                  2020.10.1        py38h0cf3a3e_2  
tk                        8.6.10               hb0a8c7a_0  
toml                      0.10.1                     py_0  
toolz                     0.11.1                     py_0  
tornado                   6.0.4            py38h1de35cc_1  
tqdm                      4.50.2                     py_0  
traitlets                 5.0.5                      py_0  
typing_extensions         3.7.4.3                    py_0  
ujson                     4.0.1            py38hb1e8313_0  
unicodecsv                0.14.1                   py38_0  
unixodbc                  2.3.9                haf1e3a3_0  
urllib3                   1.25.11                    py_0  
watchdog                  0.10.3           py38haf1e3a3_0  
wcwidth                   0.2.5                      py_0  
webencodings              0.5.1                    py38_1  
werkzeug                  1.0.1                      py_0  
wheel                     0.38.4                   pypi_0    pypi
widgetsnbextension        3.5.1                    py38_0  
wrapt                     1.11.2           py38h1de35cc_0  
wurlitzer                 2.0.1                    py38_0  
xgboost                   1.7.1           cpu_py38ha5ba132_0    conda-forge
xlrd                      1.2.0                      py_0  
xlsxwriter                1.3.7                      py_0  
xlwings                   0.20.8                   py38_0  
xlwt                      1.3.0                    py38_0  
xmltodict                 0.12.0             pyhd3eb1b0_0  
xz                        5.2.5                h1de35cc_0  
yaml                      0.2.5                haf1e3a3_0  
yapf                      0.30.0                     py_0  
zeromq                    4.3.3                hb1e8313_3  
zict                      2.0.0                      py_0  
zipp                      3.4.0              pyhd3eb1b0_0  
zlib                      1.2.11               h1de35cc_3  
zope                      1.0                      py38_1  
zope.event                4.5.0                    py38_0  
zope.interface            5.1.2            py38haf1e3a3_0  
zstd                      1.4.5                h41d2c2f_0  

Thanks for any help! I'm a bit new at this.

Data Dictionary

Hey guys - thanks for pulling this all together!!! Do you have a data dictionary explaining the columns? Most are self explanatory, but a few are cryptic (e.g. in weekly_data dakota, pacr, racr, wopr, and ..._epa).

Caching

I think the library would benefit from having a caching strategy for downloaded or processed files. One option is to download the files outside of pandas and use an http cache. This tends to be temporary, no more than 7 days. Another option is to give the user the option to read from and save to a cache, which could just involve reading/writing parquet files from the existing data directory, which would be more permanent, or to the system tmp directory, which is more transient. Let me know if either option is of interest.

import_weekly_rosters

Hello,

I noticed that in the github for this project there is a import weekly rosters option, but in the pypi page there isn't one, and it doesn't appear to exist when I install the package. I was curious if this was a coming feature or just a typo?

Thanks

Future warning with import_pbp_data()

Great package. Thank you for your hard work!

I searched through the repo and didn't find any issues for this issue. I'm using Python version 3.10 and Pandas version 1.5.2 and obtain a future warning when running import_pbp_data():

import nfl_data_py as nfl
pbp_py = nfl.import_pbp_data([2022])
/home/raerickson/miniconda3/envs/football/lib/python3.10/site-packages/nfl_data_py/__init__.py:137: FutureWarning: In a future version, `df.iloc[:, i] = newvals` will attempt to set the values inplace instead of always setting a new array. To retain the old behavior, use either `df[df.columns[i]] = newvals` or, if columns are non-unique, `df.isetitem(i, newvals)`
  plays.loc[:, cols] = plays.loc[:, cols].astype(numpy.float32)

Sorry, but I don't have time to dig in, but I think this is a quick fix.

Not up to date

It seems like the data in import_win_totals only goes to 2020. How often is this updated?

snappy issue

sorry I am new to coding but im trying to use pycharm and I put pip install nfl_data_py and this error pops up

ERROR: Failed building wheel for python-snappy
Running setup.py clean for python-snappy
Failed to build python-snappy
ERROR: Could not build wheels for python-snappy, which is required to install pyproject.toml-based projects

get_team_game_log doesn't return game results for current season

Took a look at the code and it looks like the issue is that when you're iterating over each game in the season. You're casting the points / yardages values to ints. However, the value that is scraped is an empty string when the game hasn't yet occurred causing the cast to fail.

I'd suggest either wrapping the entire parsing block in a try/except or adding empty string handling to each int cast. Happy to make a PR with each option if you'd like me to.

Error with python-snappy

Hello and apologies if this is a dumb question. I am fairly new to coding with python and am trying to install the nfl_data_py in my terminal but am getting the following error messages:

error: subprocess-exited-with-error

Building wheel for python-snappy (pyproject.toml) did not run successfully.
ERROR: Failed building wheel for python-snappy
ERROR: Could not build wheels for python-snappy, which is required to install pyproject.toml-based projects

I have tried to trouble shoot by downloading C++ and installing python-snappy separately, but to no avail. Has anyone else run into this issue and do you have any idea on how to solve.

Thanks in advance for any additional info anyone is able to provide.

What version of Python is this for? Getting an error

I have tried to install it for both Python 3.8 and 3.6 and I am getting this error:

Collecting pandas>1 (from nfl_data_py)
Could not find a version that satisfies the requirement pandas>1 (from nfl_data_py) (from versions: 0.1, 0.2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.6.0, 0.6.1, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0, 0.21.1, 0.22.0, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.24.0, 0.24.1, 0.24.2, 0.25.0, 0.25.1, 0.25.2, 0.25.3)

Data Dictionary for import_seasonal_data()

I'm new to Github so forgive me. Ultimately, I want to find routes for WR run by year. I was hoping I could get back into that with a field like RACR but I don't know what a lot of them mean. Could you help define those values? Thanks.

HTTP Error 404: Not Found

There's a chance the links have changed in nflfastR. This link doesn't seem to work:
data = pandas.read_parquet(r'https://github.com/nflverse/nflfastR-data/raw/master/data/player_stats.parquet', engine='auto')

Using Python v3.10.7 with nfl_data_py v0.2.5
Call:
nfl.import_weekly_data([2021, 2022])
Error:
HTTPError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_15024/1768614258.py in
----> 1 nfl.import_weekly_data([2021, 2022])

c:\Users\andre\AppData\Local\Programs\Python\Python310\lib\site-packages\nfl_data_py_init_.py in import_weekly_data(years, columns, downcast)
215
216 # read weekly data
--> 217 data = pandas.read_parquet(r'https://github.com/nflverse/nflfastR-data/raw/master/data/player_stats.parquet', engine='auto')
218 data = data[data['season'].isin(years)]
219

c:\Users\andre\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\parquet.py in read_parquet(path, engine, columns, storage_options, use_nullable_dtypes, **kwargs)
493 impl = get_engine(engine)
494
--> 495 return impl.read(
496 path,
497 columns=columns,

c:\Users\andre\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\parquet.py in read(self, path, columns, use_nullable_dtypes, storage_options, **kwargs)
230 to_pandas_kwargs["split_blocks"] = True # type: ignore[assignment]
231
--> 232 path_or_handle, handles, kwargs["filesystem"] = _get_path_or_handle(
233 path,
234 kwargs.pop("filesystem", None),
...
--> 643 raise HTTPError(req.full_url, code, msg, hdrs, fp)
644
645 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 404: Not Found

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.