@@ -229,82 +229,3 @@ def test_to_numpy_pandas_series_pyarrow_dtypes_numeric_with_na(dtype, expected_d
229
229
result = _to_numpy (series )
230
230
_check_result (result , expected_dtype )
231
231
npt .assert_array_equal (result , np .array ([1.0 , np .nan , 5.0 ], dtype = expected_dtype ))
232
-
233
-
234
- ########################################################################################
235
- # Test the _to_numpy function with PyArrow arrays.
236
- #
237
- # PyArrow provides the following dtypes:
238
- #
239
- # - Numeric dtypes:
240
- # - int8, int16, int32, int64
241
- # - uint8, uint16, uint32, uint64
242
- # - float16, float32, float64
243
- #
244
- # In PyArrow, array types can be specified in two ways:
245
- #
246
- # - Using string aliases (e.g., "int8")
247
- # - Using pyarrow.DataType (e.g., ``pa.int8()``)
248
- #
249
- # Reference: https://arrow.apache.org/docs/python/api/datatypes.html
250
- ########################################################################################
251
- @pytest .mark .skipif (not _HAS_PYARROW , reason = "pyarrow is not installed" )
252
- @pytest .mark .parametrize (
253
- ("dtype" , "expected_dtype" ),
254
- [
255
- pytest .param ("int8" , np .int8 , id = "int8" ),
256
- pytest .param ("int16" , np .int16 , id = "int16" ),
257
- pytest .param ("int32" , np .int32 , id = "int32" ),
258
- pytest .param ("int64" , np .int64 , id = "int64" ),
259
- pytest .param ("uint8" , np .uint8 , id = "uint8" ),
260
- pytest .param ("uint16" , np .uint16 , id = "uint16" ),
261
- pytest .param ("uint32" , np .uint32 , id = "uint32" ),
262
- pytest .param ("uint64" , np .uint64 , id = "uint64" ),
263
- pytest .param ("float16" , np .float16 , id = "float16" ),
264
- pytest .param ("float32" , np .float32 , id = "float32" ),
265
- pytest .param ("float64" , np .float64 , id = "float64" ),
266
- ],
267
- )
268
- def test_to_numpy_pyarrow_array_pyarrow_dtypes_numeric (dtype , expected_dtype ):
269
- """
270
- Test the _to_numpy function with PyArrow arrays of PyArrow numeric dtypes.
271
- """
272
- data = [1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ]
273
- if dtype == "float16" : # float16 needs special handling
274
- # Example from https://arrow.apache.org/docs/python/generated/pyarrow.float16.html
275
- data = np .array (data , dtype = np .float16 )
276
- array = pa .array (data , type = dtype )[::2 ]
277
- result = _to_numpy (array )
278
- _check_result (result , expected_dtype )
279
- npt .assert_array_equal (result , array )
280
-
281
-
282
- @pytest .mark .skipif (not _HAS_PYARROW , reason = "pyarrow is not installed" )
283
- @pytest .mark .parametrize (
284
- ("dtype" , "expected_dtype" ),
285
- [
286
- pytest .param ("int8" , np .float64 , id = "int8" ),
287
- pytest .param ("int16" , np .float64 , id = "int16" ),
288
- pytest .param ("int32" , np .float64 , id = "int32" ),
289
- pytest .param ("int64" , np .float64 , id = "int64" ),
290
- pytest .param ("uint8" , np .float64 , id = "uint8" ),
291
- pytest .param ("uint16" , np .float64 , id = "uint16" ),
292
- pytest .param ("uint32" , np .float64 , id = "uint32" ),
293
- pytest .param ("uint64" , np .float64 , id = "uint64" ),
294
- pytest .param ("float16" , np .float16 , id = "float16" ),
295
- pytest .param ("float32" , np .float32 , id = "float32" ),
296
- pytest .param ("float64" , np .float64 , id = "float64" ),
297
- ],
298
- )
299
- def test_to_numpy_pyarrow_array_pyarrow_dtypes_numeric_with_na (dtype , expected_dtype ):
300
- """
301
- Test the _to_numpy function with PyArrow arrays of PyArrow numeric dtypes and NA.
302
- """
303
- data = [1.0 , 2.0 , None , 4.0 , 5.0 , 6.0 ]
304
- if dtype == "float16" : # float16 needs special handling
305
- # Example from https://arrow.apache.org/docs/python/generated/pyarrow.float16.html
306
- data = np .array (data , dtype = np .float16 )
307
- array = pa .array (data , type = dtype )[::2 ]
308
- result = _to_numpy (array )
309
- _check_result (result , expected_dtype )
310
- npt .assert_array_equal (result , array )
0 commit comments