7373 np_1darray_dt ,
7474 np_1darray_float ,
7575 np_1darray_object ,
76- np_1darray_str ,
7776 np_1darray_td ,
7877 np_ndarray_num ,
7978 pytest_warns_bounded ,
@@ -2004,18 +2003,22 @@ def test_dtype_type() -> None:
20042003
20052004def test_types_to_numpy () -> None :
20062005 s = pd .Series (["a" , "b" , "c" ], dtype = str )
2007- check (assert_type (s .to_numpy (), np_1darray_str ), np_1darray_str )
2006+ check (assert_type (s .to_numpy (), np_1darray_object ), np_1darray_object )
2007+ check ( # <U1, not str_
2008+ assert_type (s .to_numpy (dtype = "str" , copy = True ), np_1darray ), np_1darray
2009+ )
2010+ check (assert_type (s .to_numpy (na_value = 0 ), np_1darray_object ), np_1darray_object )
20082011 check (
2009- assert_type (s .to_numpy (dtype = "str" , copy = True ), np_1darray_str ), np_1darray_str
2012+ assert_type (s .to_numpy (na_value = np .int32 (4 )), np_1darray_object ),
2013+ np_1darray_object ,
20102014 )
2011- check (assert_type (s .to_numpy (na_value = 0 ), np_1darray_str ), np_1darray_str )
2012- check (assert_type (s .to_numpy (na_value = np .int32 (4 )), np_1darray_str ), np_1darray_str )
20132015 check (
2014- assert_type (s .to_numpy (na_value = np .float16 (4 )), np_1darray_str ), np_1darray_str
2016+ assert_type (s .to_numpy (na_value = np .float16 (4 )), np_1darray_object ),
2017+ np_1darray_object ,
20152018 )
20162019 check (
2017- assert_type (s .to_numpy (na_value = np .complex128 (4 , 7 )), np_1darray_str ),
2018- np_1darray_str ,
2020+ assert_type (s .to_numpy (na_value = np .complex128 (4 , 7 )), np_1darray_object ),
2021+ np_1darray_object ,
20192022 )
20202023
20212024 check (assert_type (pd .Series ().to_numpy (), np_1darray ), np_1darray )
@@ -2024,7 +2027,7 @@ def test_types_to_numpy() -> None:
20242027def test_to_numpy () -> None :
20252028 """Test Series.to_numpy for different types."""
20262029 s_str = pd .Series (["a" , "b" , "c" ], dtype = str )
2027- check (assert_type (s_str .to_numpy (), np_1darray_str ), np_1darray_str )
2030+ check (assert_type (s_str .to_numpy (), np_1darray_object ), np_1darray_object )
20282031
20292032 s_bytes = pd .Series (["a" , "b" , "c" ]).astype (bytes )
20302033 check (assert_type (s_bytes .to_numpy (), np_1darray_bytes ), np_1darray , np .bytes_ )
0 commit comments