Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fangraphs add league="mnl" data not working #384

Open
ss77995ss opened this issue Sep 12, 2023 · 1 comment
Open

Fangraphs add league="mnl" data not working #384

ss77995ss opened this issue Sep 12, 2023 · 1 comment

Comments

@ss77995ss
Copy link

ss77995ss commented Sep 12, 2023

Hi, I followed by batting_stats document and tried to use mnl to get data but got an error

My Code:

from pybaseball import batting_stats

batting_stats(2023, league="mnl")

Error I got:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/pandas/core/internals/construction.py](https://localhost:8080/#) in _finalize_columns_and_data(content, columns, dtype)
    968     try:
--> 969         columns = _validate_or_indexify_columns(contents, columns)
    970     except AssertionError as err:

12 frames
AssertionError: 320 columns passed, passed data had 1 columns

The above exception was the direct cause of the following exception:

ValueError                                Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/pandas/core/internals/construction.py](https://localhost:8080/#) in _finalize_columns_and_data(content, columns, dtype)
    970     except AssertionError as err:
    971         # GH#26429 do not raise user-facing AssertionError
--> 972         raise ValueError(err) from err
    973 
    974     if len(contents) and contents[0].dtype == np.object_:

ValueError: 320 columns passed, passed data had 1 columns

My environment (Google Colab):

  • Python: 3.10.12
  • pybaseball: 2.2.7

I guess maybe there are some different from the respond data so the method break since I also tried all, nl and al, they still worked for me.

@ss77995ss
Copy link
Author

ss77995ss commented Sep 12, 2023

Oh my bad. I think it is because the season I selected does not have any data.
The error disappears after I use season 1940 .

Maybe we could still handle the situation if we input the wrong season?

@ss77995ss ss77995ss changed the title Fangraphs Negro League data not working Fangraphs add league="mnl" data not working Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant