nflverse / nfl_data_py

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

PBP data not available for 2022 #85

Closed nateb7722 closed 3 weeks ago

nateb7722 commented 7 months ago

I haven't had this problem before but for some reason I am getting the response "data not available for 2022" from import_pbp function. Running on macOS, python 3.10.13, pandas version 2.2.1

roe-men commented 3 months ago

also not seeing data for 2023....

JonBraund commented 1 month ago

Possibly related to your problems, I am seeing a bug with the fastparquet library and numpy versions 2+ related to np.float_ being removed. It was in a fresh installation, python 3.12.4, jupyterlab + nfl_data_py. The final error from nfl data was that the year was not available, but the stack trace showed the actual bug.

I added this to my imports to patch the problem:

import numpy as np

np.float_ = np.float64

Got the suggestion from here: https://stackoverflow.com/a/78721422

Downgrading numpy didn't work.

Brigidi commented 1 month ago

Thanks for you post Jon — I came here bc I had this issue. I followed the first recommendation in the StackOverflow post where I uninstalled numpy and then used:

pip install "numpy<2"

Posting for transparency

Possibly related to your problems, I am seeing a bug with the fastparquet library and numpy versions 2+ related to np.float_ being removed. It was in a fresh installation, python 3.12.4, jupyterlab + nfl_data_py. The final error from nfl data was that the year was not available, but the stack trace showed the actual bug.

I added this to my imports to patch the problem:

import numpy as np

np.float_ = np.float64

Got the suggestion from here: https://stackoverflow.com/a/78721422

Downgrading numpy didn't work.

alecglen commented 3 weeks ago

@JonBraund that is a separate issue. As discussed in https://github.com/nflverse/nfl_data_py/issues/98#issuecomment-2344408893, I caution against using nfl_data_py with numpy and pandas 2.0+ as they aren't yet supported and multiple issues stemming from the upgrade have been reported. I would downgrade to the latest 1.X versions for now, and keep an eye out for support via nfl_data_py 1.0 later this year!

alecglen commented 3 weeks ago

@nateb7722, @roe-men - are you still seeing missing 2022 and 2023 data now? I tried with the same python and package versions you specified, but I haven't been able to reproduce that issue yet.

Whether it's related or not, note my comment above regarding avoiding pandas 2.0+ for now.

nateb7722 commented 3 weeks ago

using np.float_ = np.float64 worked for me, haven't had this issue since

alecglen commented 3 weeks ago

@nateb7722 I published a new version of the package last night. You can install it with the command below, and then you shouldn't need the np.float_ = np.float64 patch anymore.

pip install --force-reinstall nfl_data_py==0.3.3

If you encounter that issue again with the new version, let me know and I'll re-open your ticket.

JonBraund commented 3 weeks ago

@nateb7722 I published a new version of the package last night. You can install it with the command below, and then you shouldn't need the np.float_ = np.float64 patch anymore.

pip install --force-reinstall nfl_data_py==0.3.3

If you encounter that issue again with the new version, let me know and I'll re-open your ticket.

Thank you, the change you made helped downgrade the dependencies in my environment properly. It seems to have resolved some other strange behaviour.