-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd
import io
json_data = '{"name": ["John", "Jane", "Bob"],"age": [25, 30, 35],"city": ["New York", "San Francisco", "Chicago"]}'
df = pd.read_json(io.StringIO(json_data))
print(df)
Issue Description
With numpy versions larger than 1.26.4 (haven't tested every version), it appears to fail in StringFormatter._join_multiline , because of the call to
np.array([self.adj.len(x) for x in idx]).max()
.
Similar call is in line 130.
It seems broken in numpy as np.array([0,3]).max()
fails with the same error. Reported it here.
A quick fix is to just change it to:
np.max(np.array([self.adj.len(x) for x in idx])
Expected Behavior
Should print out the dataframe (which it does with numpy==1.26.4):
name age city
0 John 25 New York
1 Jane 30 San Francisco
2 Bob 35 Chicago
Installed Versions
pandas : 2.2.2
numpy : 2.1.3
pytz : 2024.2
dateutil : 2.9.0.post0
setuptools : 56.0.0
pip : 21.1
pytest : 8.3.3
scipy : 1.14.1
sqlalchemy : 2.0.35
xlrd : 2.0.1
tzdata : 2024.2