@@ -1955,13 +1955,11 @@ def test_adding_new_conditional_column() -> None:
1955
1955
("dtype" , "infer_string" ),
1956
1956
[
1957
1957
(object , False ),
1958
- ("string[pyarrow_numpy]" , True ),
1958
+ (pd . StringDtype ( na_value = np . nan ) , True ),
1959
1959
],
1960
1960
)
1961
1961
def test_adding_new_conditional_column_with_string (dtype , infer_string ) -> None :
1962
1962
# https://github.com/pandas-dev/pandas/issues/56204
1963
- pytest .importorskip ("pyarrow" )
1964
-
1965
1963
df = DataFrame ({"a" : [1 , 2 ], "b" : [3 , 4 ]})
1966
1964
with pd .option_context ("future.infer_string" , infer_string ):
1967
1965
df .loc [df ["a" ] == 1 , "c" ] = "1"
@@ -1971,16 +1969,14 @@ def test_adding_new_conditional_column_with_string(dtype, infer_string) -> None:
1971
1969
tm .assert_frame_equal (df , expected )
1972
1970
1973
1971
1974
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
1975
1972
def test_add_new_column_infer_string ():
1976
1973
# GH#55366
1977
- pytest .importorskip ("pyarrow" )
1978
1974
df = DataFrame ({"x" : [1 ]})
1979
1975
with pd .option_context ("future.infer_string" , True ):
1980
1976
df .loc [df ["x" ] == 1 , "y" ] = "1"
1981
1977
expected = DataFrame (
1982
- {"x" : [1 ], "y" : Series (["1" ], dtype = "string[pyarrow_numpy]" )},
1983
- columns = Index (["x" , "y" ], dtype = object ),
1978
+ {"x" : [1 ], "y" : Series (["1" ], dtype = pd . StringDtype ( na_value = np . nan ) )},
1979
+ columns = Index (["x" , "y" ], dtype = "str" ),
1984
1980
)
1985
1981
tm .assert_frame_equal (df , expected )
1986
1982
0 commit comments