nflverse / nfl_data_py

Python code for working with NFL play by play data.
MIT License
260 stars 51 forks source link

[BUG] <title> 2024 season throwing an error #110

Closed datacoaching closed 1 day ago

datacoaching commented 1 day ago

Is there an existing issue for this?

Have you installed the latest development version of the package(s) in question?

If this is a data issue, have you tried clearing your nflverse cache?

I have cleared my nflverse cache and the issue persists.

What version of the package do you have?

Version: 0.3.2

Describe the bug

Using Python's NFL_DATA_PY package, the season 2024 doesn't seem to be available for the pbp data set. I do see other data sets updated with 2024. It fetches 2023 and prior years without a problem. Thank you so much for the help!

Reprex

import nfl_data_py as nfl

# Import data for a wide range of seasons and check the maximum season
df_pbp = nfl.import_pbp_data(years=range(2023, 2025))  # Fetch data up to a future year
latest_season = df_pbp['season'].max()
print(f"The latest available season in play-by-play data is: {latest_season}")

produces this error:
NameError                                 Traceback (most recent call last)
Cell In[17], line 4
      1 import nfl_data_py as nfl
      3 # Import data for a wide range of seasons and check the maximum season
----> 4 df_pbp = nfl.import_pbp_data(years=range(2023, 2025))  # Fetch data up to a future year
      5 latest_season = df_pbp['season'].max()
      6 print(f"The latest available season in play-by-play data is: {latest_season}")

File ~\anaconda3\Lib\site-packages\nfl_data_py\__init__.py:153, in import_pbp_data(years, columns, include_participation, downcast, cache, alt_path, thread_requests)
    150     pbp_data.append(raw)
    151     print(str(year) + ' done.')
--> 153 except Error as e:
    154     print(e)
    155     print('Data not available for ' + str(year))

NameError: name 'Error' is not defined

Expected Behavior

I would expect to see an output of: The latest available season in play-by-play data is: 2024

nflverse_sitrep

NA

Screenshots

No response

Additional context

No response

tanho63 commented 1 day ago

See: https://github.com/nflverse/nfl_data_py/issues/99#issuecomment-2342212809