nflverse / nfl_data_py

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

Changed downcast code to use df[cols] instead of df.loc[:, cols] #40

Closed wstrausser closed 1 year ago

wstrausser commented 1 year ago

pandas was giving me the following FutureWarning when importing data:

/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)

This change seems to have eliminated the warning.