Fangraphs add league="mnl" data not working
Opened this issue · 1 comments
ss77995ss commented
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 commented
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?