@@ -54,6 +54,7 @@ def _check_result(result, expected_dtype):
54
54
@pytest .mark .parametrize (
55
55
("data" , "expected_dtype" ),
56
56
[
57
+ # TODO(NumPy>=2.0): Remove the if-else statement after NumPy>=2.0.
57
58
pytest .param (
58
59
[1 , 2 , 3 ],
59
60
np .int32
@@ -218,9 +219,10 @@ def test_to_numpy_pandas_numeric(dtype, expected_dtype):
218
219
Test the _to_numpy function with pandas.Series of numeric dtypes.
219
220
"""
220
221
data = [1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ]
222
+ # TODO(pandas>=2.2): Remove the workaround for float16 dtype in pandas<2.2.
223
+ # float16 needs special handling for pandas < 2.2.
224
+ # Example from https://arrow.apache.org/docs/python/generated/pyarrow.float16.html
221
225
if dtype == "float16[pyarrow]" and Version (pd .__version__ ) < Version ("2.2" ):
222
- # float16 needs special handling for pandas < 2.2.
223
- # Example from https://arrow.apache.org/docs/python/generated/pyarrow.float16.html
224
226
data = np .array (data , dtype = np .float16 )
225
227
series = pd .Series (data , dtype = dtype )[::2 ] # Not C-contiguous
226
228
result = _to_numpy (series )
@@ -264,9 +266,10 @@ def test_to_numpy_pandas_numeric_with_na(dtype, expected_dtype):
264
266
dtypes and missing values (NA).
265
267
"""
266
268
data = [1.0 , 2.0 , None , 4.0 , 5.0 , 6.0 ]
269
+ # TODO(pandas>=2.2): Remove the workaround for float16 dtype in pandas<2.2.
270
+ # float16 needs special handling for pandas < 2.2.
271
+ # Example from https://arrow.apache.org/docs/python/generated/pyarrow.float16.html
267
272
if dtype == "float16[pyarrow]" and Version (pd .__version__ ) < Version ("2.2" ):
268
- # float16 needs special handling for pandas < 2.2.
269
- # Example from https://arrow.apache.org/docs/python/generated/pyarrow.float16.html
270
273
data = np .array (data , dtype = np .float16 )
271
274
series = pd .Series (data , dtype = dtype )[::2 ] # Not C-contiguous
272
275
assert series .isna ().any ()
@@ -287,6 +290,7 @@ def test_to_numpy_pandas_numeric_with_na(dtype, expected_dtype):
287
290
"string[pyarrow_numpy]" ,
288
291
marks = [
289
292
skip_if_no (package = "pyarrow" ),
293
+ # TODO(pandas>=2.1): Remove the skipif marker for pandas<2.1.
290
294
pytest .mark .skipif (
291
295
Version (pd .__version__ ) < Version ("2.1" ),
292
296
reason = "string[pyarrow_numpy] was added since pandas 2.1" ,
@@ -426,6 +430,7 @@ def test_to_numpy_pyarrow_numeric_with_na(dtype, expected_dtype):
426
430
"large_utf8" , # alias for large_string
427
431
pytest .param (
428
432
"string_view" ,
433
+ # TODO(pyarrow>=16): Remove the skipif marker for pyarrow<16.
429
434
marks = pytest .mark .skipif (
430
435
Version (pa .__version__ ) < Version ("16" ),
431
436
reason = "string_view type was added since pyarrow 16" ,
0 commit comments