Accepting request 1218705 from devel:languages:python:numeric

- Skip two tests that fail with Numpy 2.1. 

- Prepare for Python 3.13, by skipping it if we aren't building for it. 

- Update to 2.2.3
  * Bug in eval() on complex including division /
    discards imaginary part. (GH 21374)
  * Minor fixes for numpy 2.1 compatibility. (GH 59444)
  * Missing licenses for 3rd party dependencies were
    added back into the wheels. (GH 58632)
- Drop pandas-pr58269-pyarrow16xpass.patch, merged upstream
- Drop pandas-pr58484-matplotlib.patch, merged upstream
- Drop pandas-pr59175-matplotlib.patch, merged upstream
- Drop pandas-pr59353-np2eval.patch, merged upstream
- Drop tests-npdev.patch, merged upstream
- Drop tests-timedelta.patch, merged upstream
- Refresh tests-nomkl.patch
- Renumber remaining patches

OBS-URL: https://build.opensuse.org/request/show/1218705
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pandas?expand=0&rev=71
This commit is contained in:
Ana Guerrero 2024-10-28 14:17:44 +00:00 committed by Git OBS Bridge
commit 0f67c70d37
12 changed files with 74 additions and 532 deletions

View File

@ -2,7 +2,7 @@
<service name="tar_scm" mode="disabled">
<param name="url">https://github.com/pandas-dev/pandas.git</param>
<param name="scm">git</param>
<param name="revision">v2.2.2</param>
<param name="revision">v2.2.3</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">v(.*)</param>
<param name="filename">pandas</param>

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8f044538e419c7d5c03434c96b1439cbd88701dcd02d6a79b08947fbb656c2f4
size 50782448

3
pandas-2.2.3.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:be944b80189d9bbcbd269aa5f43cfe9d607149a19473121aed8d51f5d56c4ff0
size 52331559

View File

@ -1,40 +0,0 @@
From 1828b62ee913da44ec4402642ef7baaafeb65677 Mon Sep 17 00:00:00 2001
From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Date: Mon, 15 Apr 2024 09:47:31 -1000
Subject: [PATCH] Backport PR #58268: CI/TST: Unxfail
test_slice_locs_negative_step Pyarrow test
---
pandas/tests/indexes/object/test_indexing.py | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/pandas/tests/indexes/object/test_indexing.py b/pandas/tests/indexes/object/test_indexing.py
index 443cacf94d239..ebf9dac715f8d 100644
--- a/pandas/tests/indexes/object/test_indexing.py
+++ b/pandas/tests/indexes/object/test_indexing.py
@@ -7,7 +7,6 @@
NA,
is_matching_na,
)
-from pandas.compat import pa_version_under16p0
import pandas.util._test_decorators as td
import pandas as pd
@@ -201,16 +200,7 @@ class TestSliceLocs:
(pd.IndexSlice["m":"m":-1], ""), # type: ignore[misc]
],
)
- def test_slice_locs_negative_step(self, in_slice, expected, dtype, request):
- if (
- not pa_version_under16p0
- and dtype == "string[pyarrow_numpy]"
- and in_slice == slice("a", "a", -1)
- ):
- request.applymarker(
- pytest.mark.xfail(reason="https://github.com/apache/arrow/issues/40642")
- )
-
+ def test_slice_locs_negative_step(self, in_slice, expected, dtype):
index = Index(list("bcdxy"), dtype=dtype)
s_start, s_stop = index.slice_locs(in_slice.start, in_slice.stop, in_slice.step)

View File

@ -1,71 +0,0 @@
From 0cab756077f5291f8d6a7fcfacaf374f62b866a0 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 29 Apr 2024 23:11:21 -0400
Subject: [PATCH 1/2] Remove deprecated plot_date calls
These were deprecated in Matplotlib 3.9.
---
pandas/tests/plotting/test_datetimelike.py | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/pandas/tests/plotting/test_datetimelike.py b/pandas/tests/plotting/test_datetimelike.py
index 6b709522bab70..b91bde41bf4c4 100644
--- a/pandas/tests/plotting/test_datetimelike.py
+++ b/pandas/tests/plotting/test_datetimelike.py
@@ -1432,13 +1432,11 @@ def test_mpl_nopandas(self):
values1 = np.arange(10.0, 11.0, 0.5)
values2 = np.arange(11.0, 12.0, 0.5)
- kw = {"fmt": "-", "lw": 4}
-
_, ax = mpl.pyplot.subplots()
- ax.plot_date([x.toordinal() for x in dates], values1, **kw)
- ax.plot_date([x.toordinal() for x in dates], values2, **kw)
-
- line1, line2 = ax.get_lines()
+ line1, line2, = ax.plot(
+ [x.toordinal() for x in dates], values1, "-",
+ [x.toordinal() for x in dates], values2, "-",
+ linewidth=4)
exp = np.array([x.toordinal() for x in dates], dtype=np.float64)
tm.assert_numpy_array_equal(line1.get_xydata()[:, 0], exp)
From 6d6574c4e71e3bab91503f85c8aa80c927785865 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
<66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Tue, 30 Apr 2024 16:47:26 +0000
Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---
pandas/tests/plotting/test_datetimelike.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/pandas/tests/plotting/test_datetimelike.py b/pandas/tests/plotting/test_datetimelike.py
index b91bde41bf4c4..4b4eeada58366 100644
--- a/pandas/tests/plotting/test_datetimelike.py
+++ b/pandas/tests/plotting/test_datetimelike.py
@@ -1433,10 +1433,18 @@ def test_mpl_nopandas(self):
values2 = np.arange(11.0, 12.0, 0.5)
_, ax = mpl.pyplot.subplots()
- line1, line2, = ax.plot(
- [x.toordinal() for x in dates], values1, "-",
- [x.toordinal() for x in dates], values2, "-",
- linewidth=4)
+ (
+ line1,
+ line2,
+ ) = ax.plot(
+ [x.toordinal() for x in dates],
+ values1,
+ "-",
+ [x.toordinal() for x in dates],
+ values2,
+ "-",
+ linewidth=4,
+ )
exp = np.array([x.toordinal() for x in dates], dtype=np.float64)
tm.assert_numpy_array_equal(line1.get_xydata()[:, 0], exp)

View File

@ -1,29 +0,0 @@
From d4e803caf7aabd464f6fb1d43ef39903911a3cec Mon Sep 17 00:00:00 2001
From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Date: Wed, 3 Jul 2024 06:45:24 -1000
Subject: [PATCH] Backport PR #59168: TST: Address UserWarning in matplotlib
test
---
pandas/plotting/_matplotlib/core.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py
index 2979903edf360..52382d9f7d572 100644
--- a/pandas/plotting/_matplotlib/core.py
+++ b/pandas/plotting/_matplotlib/core.py
@@ -893,7 +893,13 @@ def _make_legend(self) -> None:
elif self.subplots and self.legend:
for ax in self.axes:
if ax.get_visible():
- ax.legend(loc="best")
+ with warnings.catch_warnings():
+ warnings.filterwarnings(
+ "ignore",
+ "No artists with labels found to put in legend.",
+ UserWarning,
+ )
+ ax.legend(loc="best")
@final
@staticmethod

View File

@ -1,174 +0,0 @@
diff --git a/pandas/_testing/__init__.py b/pandas/_testing/__init__.py
index 361998db8e..87d419e2db 100644
--- a/pandas/_testing/__init__.py
+++ b/pandas/_testing/__init__.py
@@ -111,6 +111,7 @@ ALL_FLOAT_DTYPES: list[Dtype] = [*FLOAT_NUMPY_DTYPES, *FLOAT_EA_DTYPES]
COMPLEX_DTYPES: list[Dtype] = [complex, "complex64", "complex128"]
STRING_DTYPES: list[Dtype] = [str, "str", "U"]
+COMPLEX_FLOAT_DTYPES: list[Dtype] = [*COMPLEX_DTYPES, *FLOAT_NUMPY_DTYPES]
DATETIME64_DTYPES: list[Dtype] = ["datetime64[ns]", "M8[ns]"]
TIMEDELTA64_DTYPES: list[Dtype] = ["timedelta64[ns]", "m8[ns]"]
diff --git a/pandas/conftest.py b/pandas/conftest.py
index 7c35dfdde9..10134c90f8 100644
--- a/pandas/conftest.py
+++ b/pandas/conftest.py
@@ -1403,6 +1403,21 @@ def complex_dtype(request):
return request.param
+@pytest.fixture(params=tm.COMPLEX_FLOAT_DTYPES)
+def complex_or_float_dtype(request):
+ """
+ Parameterized fixture for complex and numpy float dtypes.
+
+ * complex
+ * 'complex64'
+ * 'complex128'
+ * float
+ * 'float32'
+ * 'float64'
+ """
+ return request.param
+
+
@pytest.fixture(params=tm.SIGNED_INT_NUMPY_DTYPES)
def any_signed_int_numpy_dtype(request):
"""
diff --git a/pandas/core/computation/expr.py b/pandas/core/computation/expr.py
index b5861fbaeb..d642c37cea 100644
--- a/pandas/core/computation/expr.py
+++ b/pandas/core/computation/expr.py
@@ -31,7 +31,6 @@ from pandas.core.computation.ops import (
UNARY_OPS_SYMS,
BinOp,
Constant,
- Div,
FuncNode,
Op,
Term,
@@ -370,7 +369,7 @@ class BaseExprVisitor(ast.NodeVisitor):
"Add",
"Sub",
"Mult",
- None,
+ "Div",
"Pow",
"FloorDiv",
"Mod",
@@ -533,9 +532,6 @@ class BaseExprVisitor(ast.NodeVisitor):
left, right = self._maybe_downcast_constants(left, right)
return self._maybe_evaluate_binop(op, op_class, left, right)
- def visit_Div(self, node, **kwargs):
- return lambda lhs, rhs: Div(lhs, rhs)
-
def visit_UnaryOp(self, node, **kwargs):
op = self.visit(node.op)
operand = self.visit(node.operand)
diff --git a/pandas/core/computation/ops.py b/pandas/core/computation/ops.py
index 95ac20ba39..ea8b1c0457 100644
--- a/pandas/core/computation/ops.py
+++ b/pandas/core/computation/ops.py
@@ -332,31 +332,6 @@ for d in (_cmp_ops_dict, _bool_ops_dict, _arith_ops_dict):
_binary_ops_dict.update(d)
-def _cast_inplace(terms, acceptable_dtypes, dtype) -> None:
- """
- Cast an expression inplace.
-
- Parameters
- ----------
- terms : Op
- The expression that should cast.
- acceptable_dtypes : list of acceptable numpy.dtype
- Will not cast if term's dtype in this list.
- dtype : str or numpy.dtype
- The dtype to cast to.
- """
- dt = np.dtype(dtype)
- for term in terms:
- if term.type in acceptable_dtypes:
- continue
-
- try:
- new_value = term.value.astype(dt)
- except AttributeError:
- new_value = dt.type(term.value)
- term.update(new_value)
-
-
def is_term(obj) -> bool:
return isinstance(obj, Term)
@@ -516,31 +491,6 @@ class BinOp(Op):
def isnumeric(dtype) -> bool:
return issubclass(np.dtype(dtype).type, np.number)
-
-class Div(BinOp):
- """
- Div operator to special case casting.
-
- Parameters
- ----------
- lhs, rhs : Term or Op
- The Terms or Ops in the ``/`` expression.
- """
-
- def __init__(self, lhs, rhs) -> None:
- super().__init__("/", lhs, rhs)
-
- if not isnumeric(lhs.return_type) or not isnumeric(rhs.return_type):
- raise TypeError(
- f"unsupported operand type(s) for {self.op}: "
- f"'{lhs.return_type}' and '{rhs.return_type}'"
- )
-
- # do not upcast float32s to float64 un-necessarily
- acceptable_dtypes = [np.float32, np.float64]
- _cast_inplace(com.flatten(self), acceptable_dtypes, np.float64)
-
-
UNARY_OPS_SYMS = ("+", "-", "~", "not")
_unary_ops_funcs = (operator.pos, operator.neg, operator.invert, operator.invert)
_unary_ops_dict = dict(zip(UNARY_OPS_SYMS, _unary_ops_funcs))
diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py
index 17630f14b0..e8fad6b8cb 100644
--- a/pandas/tests/computation/test_eval.py
+++ b/pandas/tests/computation/test_eval.py
@@ -747,16 +747,26 @@ class TestTypeCasting:
@pytest.mark.parametrize("op", ["+", "-", "*", "**", "/"])
# maybe someday... numexpr has too many upcasting rules now
# chain(*(np.core.sctypes[x] for x in ['uint', 'int', 'float']))
- @pytest.mark.parametrize("dt", [np.float32, np.float64])
@pytest.mark.parametrize("left_right", [("df", "3"), ("3", "df")])
- def test_binop_typecasting(self, engine, parser, op, dt, left_right):
- df = DataFrame(np.random.default_rng(2).standard_normal((5, 3)), dtype=dt)
+ def test_binop_typecasting(
+ self, engine, parser, op, complex_or_float_dtype, left_right, request
+ ):
+ # GH#21374
+ dtype = complex_or_float_dtype
+ df = DataFrame(np.random.default_rng(2).standard_normal((5, 3)), dtype=dtype)
left, right = left_right
s = f"{left} {op} {right}"
res = pd.eval(s, engine=engine, parser=parser)
- assert df.values.dtype == dt
- assert res.values.dtype == dt
- tm.assert_frame_equal(res, eval(s))
+ if dtype == "complex64" and engine == "numexpr":
+ mark = pytest.mark.xfail(
+ reason="numexpr issue with complex that are upcast "
+ "to complex 128 "
+ "https://github.com/pydata/numexpr/issues/492"
+ )
+ request.applymarker(mark)
+ assert df.values.dtype == dtype
+ assert res.values.dtype == dtype
+ tm.assert_frame_equal(res, eval(s), check_exact=False)
# -------------------------------------

View File

@ -1,3 +1,31 @@
-------------------------------------------------------------------
Fri Oct 25 05:19:49 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Skip two tests that fail with Numpy 2.1.
-------------------------------------------------------------------
Fri Oct 11 04:40:52 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Prepare for Python 3.13, by skipping it if we aren't building for it.
-------------------------------------------------------------------
Tue Oct 1 12:35:22 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 2.2.3
* Bug in eval() on complex including division /
discards imaginary part. (GH 21374)
* Minor fixes for numpy 2.1 compatibility. (GH 59444)
* Missing licenses for 3rd party dependencies were
added back into the wheels. (GH 58632)
- Drop pandas-pr58269-pyarrow16xpass.patch, merged upstream
- Drop pandas-pr58484-matplotlib.patch, merged upstream
- Drop pandas-pr59175-matplotlib.patch, merged upstream
- Drop pandas-pr59353-np2eval.patch, merged upstream
- Drop tests-npdev.patch, merged upstream
- Drop tests-timedelta.patch, merged upstream
- Refresh tests-nomkl.patch
- Renumber remaining patches
-------------------------------------------------------------------
Mon Sep 16 19:39:38 UTC 2024 - Markéta Machová <mmachova@suse.com>

View File

@ -34,6 +34,9 @@
%if "%{flavor}" != "test-py312"
%define skip_python312 1
%endif
%if "%{flavor}" != "test-py313"
%define skip_python313 1
%endif
# Skip empty buildsets, last one is for sle15_python_module_pythons
%if "%{shrink:%{pythons}}" == "" || ("%pythons" == "python311" && 0%{?skip_python311})
ExclusiveArch: donotbuild
@ -61,7 +64,7 @@ ExclusiveArch: donotbuild
%endif
Name: python-pandas%{psuffix}
# Set version through _service
Version: 2.2.2
Version: 2.2.3
Release: 0
Summary: Python data structures for data analysis, time series, and statistics
License: BSD-3-Clause
@ -69,22 +72,10 @@ URL: https://pandas.pydata.org/
# SourceRepository: https://github.com/pandas-dev/pandas
# Must be created by cloning through `osc service runall`: gh#pandas-dev/pandas#54903, gh#pandas-dev/pandas#54907
Source0: pandas-%{version}.tar.gz
# PATCH-FIX-UPSTREAM pandas-pr58269-pyarrow16xpass.patch -- gh#pandas-dev/pandas#58269
Patch0: pandas-pr58269-pyarrow16xpass.patch
# PATCH-FIX-UPSTREAM pandas-pr58484-matplotlib.patch -- gh#pandas-dev/pandas#58484 mcepl@suse.com, make pandas compatible with the modern matplotlib
Patch2: pandas-pr58484-matplotlib.patch
# PATCH-FIX-UPSTREAM pandas-pr59175-matplotlib.patch -- gh#pandas-dev/pandas#59175
Patch3: https://github.com/pandas-dev/pandas/pull/59175.patch#/pandas-pr59175-matplotlib.patch
# PATCH-FIX-UPSTREAM pandas-pr59353-np2eval.patch -- gh#pandas-dev/pandas#59144 backported to 2.2, no new tests, see gh#pandas-dev/pandas#58548, gh#pandas-dev/pandas#59353
Patch4: pandas-pr59353-np2eval.patch
# PATCH-FIX-UPSTREAM gh#pandas-dev/pandas#2536d3a7
Patch5: tests-npdev.patch
# PATCH-FIX-UPSTREAM gh#pandas-dev/pandas#d0cb2056
Patch6: tests-timedelta.patch
# PATCH-FIX-UPSTREAM gh#pandas-dev/pandas#1044cf44
Patch7: tests-nomkl.patch
Patch0: tests-nomkl.patch
# PATCH-FIX-UPSTREAM tiny part of gh#pandas-dev/pandas#4f743f98
Patch8: tests-wasm.patch
Patch1: tests-wasm.patch
%if !%{with test}
BuildRequires: %{python_module Cython >= 3.0.5}
BuildRequires: %{python_module devel >= 3.9}
@ -530,6 +521,9 @@ SKIP_TESTS+=" or (test_scalar_unary and numexpr-pandas)"
SKIP_TESTS+=" or test_group_subplot_invalid_column_name"
# https://github.com/pandas-dev/pandas/pull/55901, not gonna merge this huge patch to fix one test failing with new timezone, will be included in new release
SKIP_TESTS+=" or test_array_inference[data7-expected7]"
# numpy 2.1 issues?
SKIP_TESTS+=" or test_frame_setitem_dask_array_into_new_col"
SKIP_TESTS+=" or test_from_obscure_array"
%ifarch %{ix86} %{arm32}
# https://github.com/pandas-dev/pandas/issues/31856

View File

@ -1,38 +1,7 @@
From 1044cf442109953987c1a47f476dc90d286b9f0f Mon Sep 17 00:00:00 2001
From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Date: Tue, 20 Aug 2024 10:32:23 -1000
Subject: [PATCH] CI: Uninstall nomkl & 32 bit Interval tests (#59553)
* undo numpy 2 changes?
* some interval 32 bit tests working
* Revert "undo numpy 2 changes?"
This reverts commit 39ce2229a96406edac107fc897e807251d364e2b.
* nomkl?
* nomkl?
* Update .github/actions/build_pandas/action.yml
* grep for nomkl
* xfail WASM
* Reverse condition
---
.github/actions/build_pandas/action.yml | 7 +++++++
pandas/tests/indexes/interval/test_interval_tree.py | 7 +++++--
pandas/tests/indexing/interval/test_interval.py | 4 ++--
pandas/tests/indexing/interval/test_interval_new.py | 4 ++--
4 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/pandas/tests/indexes/interval/test_interval_tree.py b/pandas/tests/indexes/interval/test_interval_tree.py
index 49b17f8b3d40e..df9c3b390f660 100644
--- a/pandas/tests/indexes/interval/test_interval_tree.py
+++ b/pandas/tests/indexes/interval/test_interval_tree.py
Binary files pandas-2.2.3.orig/.git/index and pandas-2.2.3/.git/index differ
diff -Nru pandas-2.2.3.orig/pandas/tests/indexes/interval/test_interval_tree.py pandas-2.2.3/pandas/tests/indexes/interval/test_interval_tree.py
--- pandas-2.2.3.orig/pandas/tests/indexes/interval/test_interval_tree.py 2024-09-20 12:21:50.000000000 +0000
+++ pandas-2.2.3/pandas/tests/indexes/interval/test_interval_tree.py 2024-10-01 12:32:47.570061987 +0000
@@ -4,7 +4,10 @@
import pytest
@ -45,56 +14,51 @@ index 49b17f8b3d40e..df9c3b390f660 100644
import pandas._testing as tm
@@ -186,7 +189,7 @@ def test_construction_overflow(self):
@@ -190,6 +193,7 @@
expected = (50 + np.iinfo(np.int64).max) / 2
assert result == expected
- @pytest.mark.xfail(not IS64, reason="GH 23440")
+ @pytest.mark.xfail(WASM, reason="GH 23440")
@pytest.mark.parametrize(
"left, right, expected",
[
diff --git a/pandas/tests/indexing/interval/test_interval.py b/pandas/tests/indexing/interval/test_interval.py
index b72ef57475305..6bcebefa6c696 100644
--- a/pandas/tests/indexing/interval/test_interval.py
+++ b/pandas/tests/indexing/interval/test_interval.py
@@ -2,7 +2,7 @@
import pytest
from pandas._libs import index as libindex
-from pandas.compat import IS64
+from pandas.compat import WASM
import pandas as pd
from pandas import (
@@ -210,7 +210,7 @@ def test_mi_intervalindex_slicing_with_scalar(self):
expected = Series([1, 6, 2, 8, 7], index=expected_index, name="value")
tm.assert_series_equal(result, expected)
- @pytest.mark.xfail(not IS64, reason="GH 23440")
+ @pytest.mark.xfail(WASM, reason="GH 23440")
@pytest.mark.parametrize(
"base",
[101, 1010],
diff --git a/pandas/tests/indexing/interval/test_interval_new.py b/pandas/tests/indexing/interval/test_interval_new.py
index 4c1efe9e4f81d..051dc7b98f2aa 100644
--- a/pandas/tests/indexing/interval/test_interval_new.py
+++ b/pandas/tests/indexing/interval/test_interval_new.py
@@ -3,7 +3,7 @@
diff -Nru pandas-2.2.3.orig/pandas/tests/indexing/interval/test_interval_new.py pandas-2.2.3/pandas/tests/indexing/interval/test_interval_new.py
--- pandas-2.2.3.orig/pandas/tests/indexing/interval/test_interval_new.py 2024-09-20 12:21:50.000000000 +0000
+++ pandas-2.2.3/pandas/tests/indexing/interval/test_interval_new.py 2024-10-01 12:34:25.510718974 +0000
@@ -3,6 +3,8 @@
import numpy as np
import pytest
-from pandas.compat import IS64
+from pandas.compat import WASM
+
from pandas import (
Index,
@@ -214,7 +214,7 @@ def test_loc_getitem_missing_key_error_message(
Interval,
@@ -208,7 +210,7 @@
with pytest.raises(KeyError, match=r"\[6\]"):
obj.loc[[4, 5, 6]]
-@pytest.mark.xfail(not IS64, reason="GH 23440")
-
+@pytest.mark.xfail(WASM, reason="GH 23440")
@pytest.mark.parametrize(
"intervals",
[
diff -Nru pandas-2.2.3.orig/pandas/tests/indexing/interval/test_interval.py pandas-2.2.3/pandas/tests/indexing/interval/test_interval.py
--- pandas-2.2.3.orig/pandas/tests/indexing/interval/test_interval.py 2024-09-20 12:21:50.000000000 +0000
+++ pandas-2.2.3/pandas/tests/indexing/interval/test_interval.py 2024-10-01 12:33:50.518484555 +0000
@@ -2,6 +2,7 @@
import pytest
from pandas._libs import index as libindex
+from pandas.compat import WASM
import pandas as pd
from pandas import (
@@ -35,6 +36,7 @@
expected = ser.iloc[2:5]
tm.assert_series_equal(expected, indexer_sl(ser)[ser >= 2])
+ @pytest.mark.xfail(WASM, reason="GH 23440")
@pytest.mark.parametrize("direction", ["increasing", "decreasing"])
def test_getitem_nonoverlapping_monotonic(self, direction, closed, indexer_sl):
tpls = [(0, 1), (2, 3), (4, 5)]

View File

@ -1,75 +0,0 @@
From 2536d3a736eea96b9da8b774e671516eb8f25f4a Mon Sep 17 00:00:00 2001
From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Date: Wed, 24 Apr 2024 07:26:56 -1000
Subject: [PATCH] CI: Fix npdev failures (#58389)
* CI: Fix npdev failures
* Use unique index, make array writable
* Update pandas/_libs/hashtable_class_helper.pxi.in
* Update pandas/tests/arrays/test_datetimelike.py
* Update pandas/tests/arrays/test_datetimelike.py
---
pandas/tests/arrays/test_datetimelike.py | 8 ++++++--
pandas/tests/extension/base/missing.py | 2 ++
pandas/tests/indexes/test_base.py | 4 ++--
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/pandas/tests/arrays/test_datetimelike.py b/pandas/tests/arrays/test_datetimelike.py
index 22c63af59a47c..3d8f8d791b763 100644
--- a/pandas/tests/arrays/test_datetimelike.py
+++ b/pandas/tests/arrays/test_datetimelike.py
@@ -661,7 +661,9 @@ def test_array_interface(self, datetime_index):
assert result is expected
tm.assert_numpy_array_equal(result, expected)
result = np.array(arr, dtype="datetime64[ns]")
- assert result is not expected
+ if not np_version_gt2:
+ # TODO: GH 57739
+ assert result is not expected
tm.assert_numpy_array_equal(result, expected)
# to object dtype
@@ -976,7 +978,9 @@ def test_array_interface(self, timedelta_index):
assert result is expected
tm.assert_numpy_array_equal(result, expected)
result = np.array(arr, dtype="timedelta64[ns]")
- assert result is not expected
+ if not np_version_gt2:
+ # TODO: GH 57739
+ assert result is not expected
tm.assert_numpy_array_equal(result, expected)
# to object dtype
diff --git a/pandas/tests/extension/base/missing.py b/pandas/tests/extension/base/missing.py
index 4b9234a9904a2..cee565d4f7c1e 100644
--- a/pandas/tests/extension/base/missing.py
+++ b/pandas/tests/extension/base/missing.py
@@ -27,7 +27,9 @@ def test_isna_returns_copy(self, data_missing, na_func):
expected = result.copy()
mask = getattr(result, na_func)()
if isinstance(mask.dtype, pd.SparseDtype):
+ # TODO: GH 57739
mask = np.array(mask)
+ mask.flags.writeable = True
mask[:] = True
tm.assert_series_equal(result, expected)
diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py
index 04858643d97b1..2e94961b673f8 100644
--- a/pandas/tests/indexes/test_base.py
+++ b/pandas/tests/indexes/test_base.py
@@ -71,8 +71,8 @@ def test_constructor_casting(self, index):
tm.assert_contains_all(arr, new_index)
tm.assert_index_equal(index, new_index)
- @pytest.mark.parametrize("index", ["string"], indirect=True)
- def test_constructor_copy(self, index, using_infer_string):
+ def test_constructor_copy(self, using_infer_string):
+ index = Index(list("abc"), name="name")
arr = np.array(index)
new_index = Index(arr, copy=True, name="name")
assert isinstance(new_index, Index)

View File

@ -1,55 +0,0 @@
From d0cb2056d0b27080b2f5cc0b88db8d263f684230 Mon Sep 17 00:00:00 2001
From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Date: Wed, 7 Aug 2024 10:49:25 -1000
Subject: [PATCH] COMPAT: Fix numpy 2.1 timedelta * DateOffset (#59441)
---
pandas/core/arrays/timedeltas.py | 8 ++++++++
pandas/tests/arithmetic/test_timedelta64.py | 8 +++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/pandas/core/arrays/timedeltas.py b/pandas/core/arrays/timedeltas.py
index 15bfe442ca87f..83cc2871f5459 100644
--- a/pandas/core/arrays/timedeltas.py
+++ b/pandas/core/arrays/timedeltas.py
@@ -467,6 +467,10 @@ def __mul__(self, other) -> Self:
if is_scalar(other):
# numpy will accept float and int, raise TypeError for others
result = self._ndarray * other
+ if result.dtype.kind != "m":
+ # numpy >= 2.1 may not raise a TypeError
+ # and seems to dispatch to others.__rmul__?
+ raise TypeError(f"Cannot multiply with {type(other).__name__}")
freq = None
if self.freq is not None and not isna(other):
freq = self.freq * other
@@ -494,6 +498,10 @@ def __mul__(self, other) -> Self:
# numpy will accept float or int dtype, raise TypeError for others
result = self._ndarray * other
+ if result.dtype.kind != "m":
+ # numpy >= 2.1 may not raise a TypeError
+ # and seems to dispatch to others.__rmul__?
+ raise TypeError(f"Cannot multiply with {type(other).__name__}")
return type(self)._simple_new(result, dtype=result.dtype)
__rmul__ = __mul__
diff --git a/pandas/tests/arithmetic/test_timedelta64.py b/pandas/tests/arithmetic/test_timedelta64.py
index 4583155502374..87e085fb22878 100644
--- a/pandas/tests/arithmetic/test_timedelta64.py
+++ b/pandas/tests/arithmetic/test_timedelta64.py
@@ -1460,7 +1460,13 @@ def test_td64arr_mul_int(self, box_with_array):
def test_td64arr_mul_tdlike_scalar_raises(self, two_hours, box_with_array):
rng = timedelta_range("1 days", "10 days", name="foo")
rng = tm.box_expected(rng, box_with_array)
- msg = "argument must be an integer|cannot use operands with types dtype"
+ msg = "|".join(
+ [
+ "argument must be an integer",
+ "cannot use operands with types dtype",
+ "Cannot multiply with",
+ ]
+ )
with pytest.raises(TypeError, match=msg):
rng * two_hours