@@ -1864,13 +1864,11 @@ def test_adding_new_conditional_column() -> None:
1864
1864
("dtype" , "infer_string" ),
1865
1865
[
1866
1866
(object , False ),
1867
- ("string[pyarrow_numpy]" , True ),
1867
+ (pd . StringDtype ( na_value = np . nan ) , True ),
1868
1868
],
1869
1869
)
1870
1870
def test_adding_new_conditional_column_with_string (dtype , infer_string ) -> None :
1871
1871
# https://github.com/pandas-dev/pandas/issues/56204
1872
- pytest .importorskip ("pyarrow" )
1873
-
1874
1872
df = DataFrame ({"a" : [1 , 2 ], "b" : [3 , 4 ]})
1875
1873
with pd .option_context ("future.infer_string" , infer_string ):
1876
1874
df .loc [df ["a" ] == 1 , "c" ] = "1"
@@ -1880,16 +1878,14 @@ def test_adding_new_conditional_column_with_string(dtype, infer_string) -> None:
1880
1878
tm .assert_frame_equal (df , expected )
1881
1879
1882
1880
1883
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
1884
1881
def test_add_new_column_infer_string ():
1885
1882
# GH#55366
1886
- pytest .importorskip ("pyarrow" )
1887
1883
df = DataFrame ({"x" : [1 ]})
1888
1884
with pd .option_context ("future.infer_string" , True ):
1889
1885
df .loc [df ["x" ] == 1 , "y" ] = "1"
1890
1886
expected = DataFrame (
1891
- {"x" : [1 ], "y" : Series (["1" ], dtype = "string[pyarrow_numpy]" )},
1892
- columns = Index (["x" , "y" ], dtype = object ),
1887
+ {"x" : [1 ], "y" : Series (["1" ], dtype = pd . StringDtype ( na_value = np . nan ) )},
1888
+ columns = Index (["x" , "y" ], dtype = "str" ),
1893
1889
)
1894
1890
tm .assert_frame_equal (df , expected )
1895
1891
0 commit comments