100100 np_1darray_dt ,
101101 np_1darray_float ,
102102 np_1darray_object ,
103- np_1darray_str ,
104103 np_1darray_td ,
105104 np_ndarray_num ,
106105 )
128127 np_1darray_dt ,
129128 np_1darray_float ,
130129 np_1darray_object ,
131- np_1darray_str ,
132130 np_1darray_td ,
133131 np_ndarray_num ,
134132 )
@@ -2032,18 +2030,22 @@ def test_dtype_type() -> None:
20322030
20332031def test_types_to_numpy () -> None :
20342032 s = pd .Series (["a" , "b" , "c" ], dtype = str )
2035- check (assert_type (s .to_numpy (), np_1darray_str ), np_1darray_str )
2033+ check (assert_type (s .to_numpy (), np_1darray_object ), np_1darray_object )
2034+ check ( # <U1, not str_
2035+ assert_type (s .to_numpy (dtype = "str" , copy = True ), np_1darray ), np_1darray
2036+ )
2037+ check (assert_type (s .to_numpy (na_value = 0 ), np_1darray_object ), np_1darray_object )
20362038 check (
2037- assert_type (s .to_numpy (dtype = "str" , copy = True ), np_1darray_str ), np_1darray_str
2039+ assert_type (s .to_numpy (na_value = np .int32 (4 )), np_1darray_object ),
2040+ np_1darray_object ,
20382041 )
2039- check (assert_type (s .to_numpy (na_value = 0 ), np_1darray_str ), np_1darray_str )
2040- check (assert_type (s .to_numpy (na_value = np .int32 (4 )), np_1darray_str ), np_1darray_str )
20412042 check (
2042- assert_type (s .to_numpy (na_value = np .float16 (4 )), np_1darray_str ), np_1darray_str
2043+ assert_type (s .to_numpy (na_value = np .float16 (4 )), np_1darray_object ),
2044+ np_1darray_object ,
20432045 )
20442046 check (
2045- assert_type (s .to_numpy (na_value = np .complex128 (4 , 7 )), np_1darray_str ),
2046- np_1darray_str ,
2047+ assert_type (s .to_numpy (na_value = np .complex128 (4 , 7 )), np_1darray_object ),
2048+ np_1darray_object ,
20472049 )
20482050
20492051 check (assert_type (pd .Series ().to_numpy (), np_1darray ), np_1darray )
@@ -2052,7 +2054,7 @@ def test_types_to_numpy() -> None:
20522054def test_to_numpy () -> None :
20532055 """Test Series.to_numpy for different types."""
20542056 s_str = pd .Series (["a" , "b" , "c" ], dtype = str )
2055- check (assert_type (s_str .to_numpy (), np_1darray_str ), np_1darray_str )
2057+ check (assert_type (s_str .to_numpy (), np_1darray_object ), np_1darray_object )
20562058
20572059 s_bytes = pd .Series (["a" , "b" , "c" ]).astype (bytes )
20582060 check (assert_type (s_bytes .to_numpy (), np_1darray_bytes ), np_1darray , np .bytes_ )
0 commit comments