nflverse / nfl_data_py

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

Help - Novice here #73

Closed JohnZNFL closed 11 months ago

JohnZNFL commented 11 months ago

I'm trying to pull in some data from nfl_data_py and get the following error message. Same happens for any year I include. I did a pip install and verified the package is loaded. - thanks

screenshot python code

alecglen commented 11 months ago

Hey @JohnZNFL, it looks like there's actually an error here that the package is accidentally hiding. Could you please try running the following in your notebook and let me know what you get?

pandas.read_parquet("https://github.com/nflverse/nflverse-data/releases/download/pbp/play_by_play_2021.parquet")

JohnZNFL commented 11 months ago

thanks @alecglen I ran the code but changed pandas to pd

Screenshout python 2

alecglen commented 11 months ago

Interesting, I kind of expected a failure there. 🤔

Here is the gist of the code that could cause that particular error. Does this work on yours?

import pandas as pd

pbp_data = []

data = pd.read_parquet("https://github.com/nflverse/nflverse-data/releases/download/pbp/play_by_play_2021.parquet", columns=None, engine='auto')

raw = pd.DataFrame(data)
raw['season'] = 2021

pbp_data.append(raw)
print(str(2021) + ' done.')

pbp_data[0]
JohnZNFL commented 11 months ago

that works Screenshot python code 3

alecglen commented 11 months ago

Switching gears - can you post the output of running pip freeze in your command prompt?

JohnZNFL commented 11 months ago

Here you go

pip freeze alabaster==0.7.12 anaconda-client==1.7.2 anaconda-navigator==1.10.0 anaconda-project==0.8.3 appdirs==1.4.4 argh==0.26.2 argon2-cffi @ file:///C:/ci/argon2-cffi_1596828585465/work asn1crypto @ file:///tmp/build/80754af9/asn1crypto_1596577642040/work astroid @ file:///C:/ci/astroid_1592487315634/work astropy==4.0.2 async-generator==1.10 atomicwrites==1.4.0 attrs @ file:///tmp/build/80754af9/attrs_1604765588209/work autopep8 @ file:///tmp/build/80754af9/autopep8_1596578164842/work Babel @ file:///tmp/build/80754af9/babel_1605108370292/work backcall==0.2.0 backports.functools-lru-cache @ file:///tmp/build/80754af9/backports.functools_lru_cache_1618170165463/work backports.shutil-get-terminal-size==1.0.0 backports.tempfile @ file:///home/linux1/recipes/ci/backports.tempfile_1610991236607/work backports.weakref==1.0.post1 bcrypt @ file:///C:/ci/bcrypt_1597936263757/work beautifulsoup4 @ file:///tmp/build/80754af9/beautifulsoup4_1601924105527/work bitarray @ file:///C:/ci/bitarray_1605065210072/work bkcharts==0.2 bleach @ file:///tmp/build/80754af9/bleach_1600439572647/work bokeh @ file:///C:/ci/bokeh_1603297934731/work boto==2.49.0 Bottleneck==1.3.2 brotlipy==0.7.0 bs4==0.0.1 certifi==2020.6.20 cffi @ file:///C:/ci/cffi_1600699246375/work chardet==3.0.4 click==7.1.2 cloudpickle @ file:///tmp/build/80754af9/cloudpickle_1598884132938/work clyent==1.2.2 colorama @ file:///tmp/build/80754af9/colorama_1603211150991/work comtypes==1.1.7 conda==4.11.0 conda-build==3.20.5 conda-package-handling @ file:///C:/b/abs_ce4_vcfd0y/croot/conda-package-handling_1685024800103/work conda-package-streaming @ file:///C:/b/abs_88a7k_wmm1/croot/conda-package-streaming_1685019697115/work conda-verify==3.4.2 contextlib2==0.6.0.post1 cramjam==2.5.0 cryptography @ file:///C:/ci/cryptography_1601046905460/work cycler==0.10.0 cypari==2.4.1 Cython @ file:///C:/ci/cython_1594829190914/work cytoolz==0.11.0 dask @ file:///tmp/build/80754af9/dask-core_1602083700509/work DateTime==4.3 decorator==4.4.2 defusedxml==0.6.0 diff-match-patch @ file:///tmp/build/80754af9/diff-match-patch_1594828741838/work distributed @ file:///C:/ci/distributed_1605066635297/work docutils==0.16 entrypoints==0.3 et-xmlfile==1.0.1 fastcache==1.1.0 fastparquet==0.7.2 filelock==3.0.12 flake8 @ file:///tmp/build/80754af9/flake8_1601911421857/work Flask==1.1.2 fsspec @ file:///tmp/build/80754af9/fsspec_1602684995936/work future==0.18.2 FXrays==1.3.5 gevent @ file:///C:/ci/gevent_1601397627942/work glob2==0.7 greenlet @ file:///C:/ci/greenlet_1600885448389/work h5py==2.10.0 HeapDict==1.0.1 html5lib @ file:///tmp/build/80754af9/html5lib_1593446221756/work idna @ file:///tmp/build/80754af9/idna_1593446292537/work imageio @ file:///tmp/build/80754af9/imageio_1594161405741/work imagesize==1.2.0 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1602276842396/work iniconfig @ file:///tmp/build/80754af9/iniconfig_1602780191262/work intervaltree @ file:///tmp/build/80754af9/intervaltree_1598376443606/work ipykernel @ file:///C:/ci/ipykernel_1596190155316/work/dist/ipykernel-5.3.4-py3-none-any.whl ipython @ file:///C:/ci/ipython_1604083276484/work ipython-genutils==0.2.0 ipywidgets @ file:///tmp/build/80754af9/ipywidgets_1601490159889/work isort @ file:///tmp/build/80754af9/isort_1602603989581/work itsdangerous==1.1.0 jdcal==1.4.1 jedi @ file:///C:/ci/jedi_1592833825077/work Jinja2==2.11.2 joblib @ file:///tmp/build/80754af9/joblib_1601912903842/work json5==0.9.5 jsonschema @ file:///tmp/build/80754af9/jsonschema_1602607155483/work jupyter==1.0.0 jupyter-client @ file:///tmp/build/80754af9/jupyter_client_1601311786391/work jupyter-console @ file:///tmp/build/80754af9/jupyter_console_1598884538475/work jupyter-core==4.6.3 jupyterlab==2.2.6 jupyterlab-pygments @ file:///tmp/build/80754af9/jupyterlab_pygments_1601490720602/work jupyterlab-server @ file:///tmp/build/80754af9/jupyterlab_server_1594164409481/work keyring @ file:///C:/ci/keyring_1601489747083/work kiwisolver @ file:///C:/ci/kiwisolver_1604014703538/work knot-floer-homology==1.1 lazy-object-proxy==1.4.3 libarchive-c==2.9 llvmlite==0.34.0 locket==0.2.0 lxml @ file:///C:/ci/lxml_1603216366346/work MarkupSafe==1.1.1 matplotlib @ file:///C:/ci/matplotlib-base_1603355780617/work mccabe==0.6.1 menuinst==1.4.16 mistune==0.8.4 mkl-fft==1.2.0 mkl-random==1.1.1 mkl-service==2.3.0 mock==4.0.2 more-itertools @ file:///tmp/build/80754af9/more-itertools_1605111547926/work mpmath==1.1.0 msgpack==1.0.0 multipledispatch==0.6.0 navigator-updater==0.2.1 nbclient @ file:///tmp/build/80754af9/nbclient_1602783176460/work nbconvert @ file:///C:/ci/nbconvert_1601914925608/work nbformat @ file:///tmp/build/80754af9/nbformat_1602783287752/work nest-asyncio @ file:///tmp/build/80754af9/nest-asyncio_1605115881283/work networkx @ file:///tmp/build/80754af9/networkx_1598376031484/work nfl-data-py==0.2.5 nflfastpy==0.0.14 nltk @ file:///tmp/build/80754af9/nltk_1592496090529/work nose==1.3.7 notebook @ file:///C:/ci/notebook_1601501643625/work numba==0.51.2 numexpr==2.7.1 numpy @ file:///C:/ci/numpy_and_numpy_base_1603466732592/work numpydoc @ file:///tmp/build/80754af9/numpydoc_1605117425582/work olefile==0.46 openpyxl @ file:///tmp/build/80754af9/openpyxl_1598113097404/work packaging==20.4 pandas @ file:///C:/ci/pandas_1602083338010/work pandocfilters @ file:///C:/ci/pandocfilters_1605102497129/work paramiko @ file:///tmp/build/80754af9/paramiko_1598886428689/work parso==0.7.0 partd==1.1.0 path @ file:///C:/ci/path_1598358556930/work pathlib2==2.3.5 pathtools==0.1.2 patsy==0.5.1 pep8==1.7.1 pexpect==4.8.0 pickleshare==0.7.5 Pillow @ file:///C:/ci/pillow_1603823068645/work pkginfo==1.6.1 plink==2.4.1 pluggy==0.13.1 ply==3.11 prometheus-client==0.8.0 prompt-toolkit @ file:///tmp/build/80754af9/prompt-toolkit_1602688806899/work psutil @ file:///C:/ci/psutil_1598370330503/work py @ file:///tmp/build/80754af9/py_1593446248552/work pycodestyle==2.6.0 pycosat==0.6.3 pycparser @ file:///tmp/build/80754af9/pycparser_1594388511720/work pycurl==7.43.0.6 pydocstyle @ file:///tmp/build/80754af9/pydocstyle_1598885001695/work pyflakes==2.2.0 Pygments @ file:///tmp/build/80754af9/pygments_1604103097372/work pylint @ file:///C:/ci/pylint_1598617153160/work PyNaCl @ file:///C:/ci/pynacl_1595000047588/work pyodbc===4.0.0-unsupported pyOpenSSL @ file:///tmp/build/80754af9/pyopenssl_1594392929924/work pyparsing==2.4.7 PyPDF2==1.26.0 pypng==0.0.21 pyreadline==2.1 pyreadr==0.4.4 pyrsistent @ file:///C:/ci/pyrsistent_1600141795814/work PySocks==1.7.1 pytest==0.0.0 python-dateutil==2.8.1 python-jsonrpc-server @ file:///tmp/build/80754af9/python-jsonrpc-server_1600278539111/work python-language-server @ file:///tmp/build/80754af9/python-language-server_1600454544709/work python-snappy==0.6.0 pytz==2020.1 PyWavelets @ file:///C:/ci/pywavelets_1601658407916/work pywin32==227 pywin32-ctypes==0.2.0 pywinpty==0.5.7 PyYAML==5.3.1 pyzmq==19.0.2 QDarkStyle==2.8.1 QtAwesome @ file:///tmp/build/80754af9/qtawesome_1602272867890/work qtconsole @ file:///tmp/build/80754af9/qtconsole_1600870028330/work QtPy==1.9.0 regex @ file:///C:/ci/regex_1602770567298/work requests @ file:///tmp/build/80754af9/requests_1592841827918/work rope @ file:///tmp/build/80754af9/rope_1602264064449/work Rtree==0.9.4 ruamel-yaml==0.15.87 scikit-image==0.17.2 scikit-learn @ file:///C:/ci/scikit-learn_1598377018496/work scipy @ file:///C:/ci/scipy_1604596260408/work seaborn @ file:///tmp/build/80754af9/seaborn_1600553570093/work Send2Trash==1.5.0 simplegeneric==0.8.1 singledispatch @ file:///tmp/build/80754af9/singledispatch_1602523705405/work sip==4.19.13 six @ file:///C:/ci/six_1605187374963/work snappy==3.0.3 snappy-manifolds==1.1.2 snowballstemmer==2.0.0 sortedcollections==1.2.1 sortedcontainers==2.2.2 soupsieve==2.0.1 spherogram==2.1 Sphinx @ file:///tmp/build/80754af9/sphinx_1597428793432/work sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==1.0.3 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.4 sphinxcontrib-websupport @ file:///tmp/build/80754af9/sphinxcontrib-websupport_1597081412696/work spyder @ file:///C:/ci/spyder_1599054115447/work spyder-kernels @ file:///C:/ci/spyder-kernels_1599051709837/work SQLAlchemy @ file:///C:/ci/sqlalchemy_1603818908746/work statsmodels==0.12.0 sympy @ file:///C:/ci/sympy_1605101511098/work tables==3.6.1 tblib @ file:///tmp/build/80754af9/tblib_1597928476713/work terminado==0.9.1 testpath==0.4.4 threadpoolctl @ file:///tmp/tmp9twdgx9k/threadpoolctl-2.1.0-py3-none-any.whl thrift==0.15.0 tifffile==2020.10.1 toml @ file:///tmp/build/80754af9/toml_1592853716807/work toolz @ file:///tmp/build/80754af9/toolz_1601054250827/work tornado==6.0.4 tqdm @ file:///tmp/build/80754af9/tqdm_1602185206534/work traitlets @ file:///tmp/build/80754af9/traitlets_1602787416690/work typing-extensions @ file:///tmp/build/80754af9/typing_extensions_1598376058250/work ujson @ file:///C:/ci/ujson_1602505266082/work unicodecsv==0.14.1 urllib3 @ file:///tmp/build/80754af9/urllib3_1603305693037/work watchdog @ file:///C:/ci/watchdog_1593447437088/work wcwidth @ file:///tmp/build/80754af9/wcwidth_1593447189090/work webencodings==0.5.1 Werkzeug==1.0.1 widgetsnbextension==3.5.1 win-inet-pton==1.1.0 win-unicode-console==0.5 wincertstore==0.2 wrapt==1.11.2 xlrd==1.2.0 XlsxWriter @ file:///tmp/build/80754af9/xlsxwriter_1602692860603/work xlwings==0.20.8 xlwt==1.3.0 xmltodict @ file:///Users/ktietz/demo/mc3/conda-bld/xmltodict_1629301980723/work yapf @ file:///tmp/build/80754af9/yapf_1593528177422/work zict==2.0.0 zipp @ file:///tmp/build/80754af9/zipp_1604001098328/work zope.event==4.5.0 zope.interface @ file:///C:/ci/zope.interface_1602002494740/work zstandard==0.19.0

alecglen commented 11 months ago

I'm still unable to reproduce, but it seems likely related to your local version of the package being outdated.

Please run pip install --upgrade nfl-data-py, and also ensure your pandas version is at least 2.0, then restart your Jupyter kernel and see if that resolves the issue.

JohnZNFL commented 11 months ago

Thanks @alecglen it works now, It was the version of pandas.