nflverse / nfl_data_py

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

Future warning with import_pbp_data() #42

Closed raerickson closed 1 year ago

raerickson commented 1 year ago

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.

alecglen commented 1 year ago

Hey @raerickson, appreciate the report! It seems that is actually a Pandas issue they're working on currently. https://github.com/pandas-dev/pandas/issues/48673

raerickson commented 1 year ago

@alecglen Thanks for digging in. Should my issue be closed? Or do you want to leave it open in case others try to report the bug.

alecglen commented 1 year ago

@raerickson This can be closed now. The issue should be resolved if you update your Pandas to version 1.5.3+.