1
0
forked from pool/python-pandas

- Add pandas-pr58269-pyarrow16xpass.patch

(gh#pandas-dev/pandas!58269)
- Add pandas-pr58720-xarray-dp.patch
  (gh#pandas-dev/pandas!58720), which makes pandas compatible
  with the modern xarray
- Add pandas-pr58484-matplotlib.patch
  (gh#pandas-dev/pandas!58484), which makes pandas compatible
  with the modern matplotlib

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pandas?expand=0&rev=119
This commit is contained in:
Matej Cepl 2024-06-07 16:33:39 +00:00 committed by Git OBS Bridge
parent dc27535a17
commit 8946b05778
4 changed files with 127 additions and 2 deletions

View File

@ -0,0 +1,71 @@
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

@ -0,0 +1,41 @@
From d36f6dac81b577504386b53357270d9f05a9bc89 Mon Sep 17 00:00:00 2001
From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Date: Tue, 14 May 2024 09:04:20 -1000
Subject: [PATCH] Backport PR #58719: CI: xfail test_to_xarray_index_types due
to new 2024.5 release
---
pandas/tests/generic/test_to_xarray.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/pandas/tests/generic/test_to_xarray.py b/pandas/tests/generic/test_to_xarray.py
index d8401a8b2ae3f..491f621783a76 100644
--- a/pandas/tests/generic/test_to_xarray.py
+++ b/pandas/tests/generic/test_to_xarray.py
@@ -9,6 +9,7 @@
date_range,
)
import pandas._testing as tm
+from pandas.util.version import Version
pytest.importorskip("xarray")
@@ -29,11 +30,17 @@ def df(self):
}
)
- def test_to_xarray_index_types(self, index_flat, df, using_infer_string):
+ def test_to_xarray_index_types(self, index_flat, df, using_infer_string, request):
index = index_flat
# MultiIndex is tested in test_to_xarray_with_multiindex
if len(index) == 0:
pytest.skip("Test doesn't make sense for empty index")
+ import xarray
+
+ if Version(xarray.__version__) >= Version("2024.5"):
+ request.applymarker(
+ pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/9026")
+ )
from xarray import Dataset

View File

@ -1,7 +1,14 @@
-------------------------------------------------------------------
Sun May 12 17:57:39 UTC 2024 - Matej Cepl <mcepl@cepl.eu>
- Reverting, apparently it was a bad idea.
- Add pandas-pr58269-pyarrow16xpass.patch
(gh#pandas-dev/pandas!58269)
- Add pandas-pr58720-xarray-dp.patch
(gh#pandas-dev/pandas!58720), which makes pandas compatible
with the modern xarray
- Add pandas-pr58484-matplotlib.patch
(gh#pandas-dev/pandas!58484), which makes pandas compatible
with the modern matplotlib
-------------------------------------------------------------------
Thu May 9 23:44:42 UTC 2024 - Matej Cepl <mcepl@cepl.eu>

View File

@ -70,7 +70,13 @@ URL: https://pandas.pydata.org/
# 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: https://github.com/pandas-dev/pandas/pull/58269.patch#/pandas-pr58269-pyarrow16xpass.patch
Patch0: pandas-pr58269-pyarrow16xpass.patch
# PATCH-FIX-UPSTREAM pandas-pr58720-xarray-dp.patch gh#pandas-dev/pandas!58720 mcepl@suse.com
# make pandas compatible with the modern xarray
Patch1: pandas-pr58720-xarray-dp.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
%if !%{with test}
BuildRequires: %{python_module Cython >= 3.0.5}
BuildRequires: %{python_module devel >= 3.9}