Skip to content

Commit

Permalink
CI: Fix ci for numpy 2 failures (#59545)
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl authored Aug 19, 2024
1 parent a7a1410 commit 5d0f9a8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pandas/plotting/_matplotlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def _maybe_right_yaxis(self, ax: Axes, axes_num: int) -> Axes:
new_ax.set_yscale("log")
elif self.logy == "sym" or self.loglog == "sym":
new_ax.set_yscale("symlog")
return new_ax # type: ignore[return-value]
return new_ax

@final
@cache_readonly
Expand Down
4 changes: 4 additions & 0 deletions pandas/tests/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,10 @@ def test_duplicate_columns(self, fp):
msg = "Cannot create parquet dataset with duplicate column names"
self.check_error_on_write(df, fp, ValueError, msg)

@pytest.mark.xfail(
Version(np.__version__) >= Version("2.0.0"),
reason="fastparquet uses np.float_ in numpy2",
)
def test_bool_with_none(self, fp):
df = pd.DataFrame({"a": [True, None, False]})
expected = pd.DataFrame({"a": [1.0, np.nan, 0.0]}, dtype="float16")
Expand Down
11 changes: 9 additions & 2 deletions pandas/tests/plotting/frame/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
_check_visible,
get_y_axis,
)
from pandas.util.version import Version

from pandas.io.formats.printing import pprint_thing

Expand Down Expand Up @@ -2465,8 +2466,14 @@ def test_group_subplot_invalid_column_name(self):
d = {"a": np.arange(10), "b": np.arange(10)}
df = DataFrame(d)

with pytest.raises(ValueError, match=r"Column label\(s\) \['bad_name'\]"):
df.plot(subplots=[("a", "bad_name")])
if Version(np.__version__) < Version("2.0.0"):
with pytest.raises(ValueError, match=r"Column label\(s\) \['bad_name'\]"):
df.plot(subplots=[("a", "bad_name")])
else:
with pytest.raises(
ValueError, match=r"Column label\(s\) \[np\.str\_\('bad_name'\)\]"
):
df.plot(subplots=[("a", "bad_name")])

def test_group_subplot_duplicated_column(self):
d = {"a": np.arange(10), "b": np.arange(10), "c": np.arange(10)}
Expand Down

0 comments on commit 5d0f9a8

Please sign in to comment.