@@ -170,6 +170,7 @@ def test_to_numpy_pandas_series_numpy_dtypes_numeric(dtype, expected_dtype):
170
170
# - int8, int16, int32, int64
171
171
# - uint8, uint16, uint32, uint64
172
172
# - float16, float32, float64
173
+ # - String dtypes: string/utf8, large_string/large_utf8, string_view
173
174
#
174
175
# In PyArrow, array types can be specified in two ways:
175
176
#
@@ -238,3 +239,25 @@ def test_to_numpy_pyarrow_array_pyarrow_dtypes_numeric_with_na(dtype, expected_d
238
239
result = _to_numpy (array )
239
240
_check_result (result , expected_dtype )
240
241
npt .assert_array_equal (result , array )
242
+
243
+
244
+ @pytest .mark .skipif (not _HAS_PYARROW , reason = "pyarrow is not installed" )
245
+ @pytest .mark .parametrize (
246
+ "dtype" ,
247
+ [
248
+ None ,
249
+ "string" ,
250
+ "utf8" , # alias for string
251
+ "large_string" ,
252
+ "large_utf8" , # alias for large_string
253
+ "string_view" ,
254
+ ],
255
+ )
256
+ def test_to_numpy_pyarrow_array_pyarrow_dtypes_string (dtype ):
257
+ """
258
+ Test the _to_numpy function with PyArrow arrays of PyArrow string types.
259
+ """
260
+ array = pa .array (["abc" , "defg" , "12345" ], type = dtype )
261
+ result = _to_numpy (array )
262
+ _check_result (result , np .str_ )
263
+ npt .assert_array_equal (result , array )
0 commit comments