Skip to content

Commit 09d7019

Browse files
authored
Fix deprecated string[pyarrow_numpy] in test_to_numpy_pandas_string (#4186)
* Fix deprecated string[pyarrow_numpy] in test_to_numpy_pandas_string Xref pandas-dev/pandas#60152 * Add conditional to support string[pyarrow_numpy] for pandas<=2.2 Handle pd.StringDtype not having the na_value parameter in pandas 2.2 and below. * Just use "str" for pyarrow backed arrays in pandas>=3.0 Otherwise will get an error on Python 3.12 tests when pd.StringDtype(storage="pyarrow", ...) is called without pyarrow installed.
1 parent fe05c56 commit 09d7019

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pygmt/tests/test_clib_to_numpy.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,15 @@ def test_to_numpy_pandas_numeric_with_na(dtype, expected_dtype):
371371
"U10",
372372
"string[python]",
373373
pytest.param("string[pyarrow]", marks=skip_if_no(package="pyarrow")),
374-
pytest.param("string[pyarrow_numpy]", marks=skip_if_no(package="pyarrow")),
374+
pytest.param(
375+
# TODO(pandas>=3.0): Remove the string[pyarrow_numpy] else statement
376+
(
377+
"str" # pyarrow string dtype in pandas>=3.0
378+
if Version(pd.__version__) >= Version("3.0.0.dev0")
379+
else "string[pyarrow_numpy]"
380+
),
381+
marks=skip_if_no(package="pyarrow"),
382+
),
375383
],
376384
)
377385
def test_to_numpy_pandas_string(dtype):

0 commit comments

Comments
 (0)