Skip to content

Commit

Permalink
ngs data pull updated
Browse files Browse the repository at this point in the history
handles specified ngs seasons correctly now
  • Loading branch information
cooperdff committed Jul 30, 2022
1 parent 7e6e342 commit bcff032
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions nfl_data_py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,12 +658,11 @@ def import_ngs_data(stat_type, years=None):
raise ValueError('years variable must be list or range.')

# import data
if len(years) == 0:
url = r'https://github.com/nflverse/nflverse-data/releases/download/nextgen_stats/ngs_{0}.parquet'.format(stat_type)
data = pandas.read_parquet(url)
else:
url = r'https://github.com/nflverse/nflverse-data/releases/download/nextgen_stats/ngs_{0}_{1}.parquet'
data = pandas.concat([pandas.read_parquet(url.format(x, stat_type), engine='auto') for x in years])
url = r'https://github.com/nflverse/nflverse-data/releases/download/nextgen_stats/ngs_{0}.parquet'.format(stat_type)
data = pandas.read_parquet(url)

if len(years) > 0:
data = data[data['season'].isin([x for x in years])]

# return
return data
Expand Down
Binary file modified nfl_data_py/__pycache__/__init__.cpython-39.pyc
Binary file not shown.

0 comments on commit bcff032

Please sign in to comment.