File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1608,7 +1608,7 @@ def construct_1d_ndarray_preserving_na(
1608
1608
"""
1609
1609
subarr = np .array (values , dtype = dtype , copy = copy )
1610
1610
1611
- if dtype is not None and dtype .kind in ( "U" , "S" ) :
1611
+ if dtype is not None and dtype .kind == "U" :
1612
1612
# GH-21083
1613
1613
# We can't just return np.array(subarr, dtype='str') since
1614
1614
# NumPy will convert the non-string objects into strings
Original file line number Diff line number Diff line change @@ -785,6 +785,14 @@ def non_reducing_function(val):
785
785
df .applymap (func )
786
786
assert values == df .a .to_list ()
787
787
788
+ def test_apply_with_byte_string (self ):
789
+ # GH 34529
790
+ try :
791
+ df = pd .DataFrame (np .array ([b"abcd" , b"efgh" ]), columns = ["col" ])
792
+ df .apply (lambda x : x .astype ("object" ))
793
+ except OSError as err :
794
+ tm .external_error_raised (err )
795
+
788
796
789
797
class TestInferOutputShape :
790
798
# the user has supplied an opaque UDF where
You can’t perform that action at this time.
0 commit comments