pybaseball: Can't seem to get pitching/batting stats.

I was following a tutorial grabbing batting and pitching stats and my Pandas Dataframe was only returning an Empty Dataframe with the only column being “IDfg”. I then went to the repo and copy pasted the batting_stats() and pitching_stats() code examples and am still getting the same thing. Statcast function works for me though, would like to see if I’m doing something wrong

`` pybaseball

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 19

Most upvoted comments

Also, you might need to restart your notebook / kernel following the install of %pip install git+https://github.com/jldbc/pybaseball.git@master

worked flawlessly! thanks so much for the help, thought the FanGraphs update was gonna completely derail the rest of the season. I really appreciate it, take care!

@shortenedname @tcamino24 Do you have these message showing on your kernel? If so try to type Y and submit to confirm the target. Then it will process the uninstall process.

pip uninstall pybaseball

Found existing installation: pybaseball 2.2.5
Uninstalling pybaseball-2.2.5:
  Would remove:
    /usr/local/lib/python3.10/dist-packages/pybaseball-2.2.5.dist-info/*
    /usr/local/lib/python3.10/dist-packages/pybaseball/*
Proceed (Y/n)?

@stephenlacey531 @ss77995ss thank you both for being lovely and helping me out. I got in the terminal of jupyterlabs and uninstalled, then ran the %pip install git+https://github.com/jldbc/pybaseball.git@master in an actual notebook in Jupyter and not my add-on in VSCode, restarted the kernel and it worked on both Jupyter and in VSCode. 👍

I kind of want to close the issue, but I’ll wait for @tcamino24 to read my update and see if what I did works for them

Thanks for the suggestion @ss77995ss, because I hadn’t thought of that either. I found copy/pasting the lines as is will lead to a inf. loop and a kernel crash like @tcamino24 is experiencing. I tried using %pip install git+https://github.com/jldbc/pybaseball.git@master and that also has given empty dataframes when importing batting_stats and pitching_stats 😕

Hey @ss77995ss currently having these same issues in JupyterLab environment. The kernel will not finish when i try and run pip uninstall pybaseball or when i try and call on the newly imported package provided above in this thread

Works for me thx !

I think it is the same issue with #376 The fix PR is merged to the main branch but not release to PyPI.

Therefore, if you want to have the fix version you might try to uninstall pybaseball and install the main branch’s code.

- pip install pybaseball
# if the package has already been installed
+ pip uninstall pybaseball
+ pip install git+https://github.com/jldbc/pybaseball.git@master