File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 11
11
Index ,
12
12
MultiIndex ,
13
13
Series ,
14
+ set_option
14
15
)
15
16
import pandas ._testing as tm
16
17
from pandas .core .strings .accessor import StringMethods
@@ -778,3 +779,11 @@ def test_series_str_decode():
778
779
result = Series ([b"x" , b"y" ]).str .decode (encoding = "UTF-8" , errors = "strict" )
779
780
expected = Series (["x" , "y" ], dtype = "str" )
780
781
tm .assert_series_equal (result , expected )
782
+
783
+ def test_decode_with_dtype_none ():
784
+ # Ensure that future.infer_string is enabled
785
+ set_option ('future.infer_string' , True )
786
+ ser = Series ([b'a' , b'b' , b'c' ]) # Use byte strings
787
+ result = ser .str .decode ('utf-8' , dtype = None )
788
+ expected = Series (['a' , 'b' , 'c' ], dtype = 'str' )
789
+ tm .assert_series_equal (result , expected )
You can’t perform that action at this time.
0 commit comments