@@ -1117,10 +1117,12 @@ def test_string_inference(self, tmp_path, pa):
1117
1117
df .to_parquet (path , engine = "pyarrow" )
1118
1118
with pd .option_context ("future.infer_string" , True ):
1119
1119
result = read_parquet (path , engine = "pyarrow" )
1120
+ dtype = pd .StringDtype (na_value = np .nan )
1120
1121
expected = pd .DataFrame (
1121
1122
data = {"a" : ["x" , "y" ]},
1122
- dtype = pd .StringDtype (na_value = np .nan ),
1123
- index = pd .Index (["a" , "b" ], dtype = pd .StringDtype (na_value = np .nan )),
1123
+ dtype = dtype ,
1124
+ index = pd .Index (["a" , "b" ], dtype = dtype ),
1125
+ columns = pd .Index (["a" ], dtype = object if pa_version_under19p0 else dtype ),
1124
1126
)
1125
1127
tm .assert_frame_equal (result , expected )
1126
1128
@@ -1133,7 +1135,10 @@ def test_roundtrip_decimal(self, tmp_path, pa):
1133
1135
df = pd .DataFrame ({"a" : [Decimal ("123.00" )]}, dtype = "string[pyarrow]" )
1134
1136
df .to_parquet (path , schema = pa .schema ([("a" , pa .decimal128 (5 ))]))
1135
1137
result = read_parquet (path )
1136
- expected = pd .DataFrame ({"a" : ["123" ]}, dtype = "string[python]" )
1138
+ if pa_version_under19p0 :
1139
+ expected = pd .DataFrame ({"a" : ["123" ]}, dtype = "string[python]" )
1140
+ else :
1141
+ expected = pd .DataFrame ({"a" : [Decimal ("123.00" )]}, dtype = "object" )
1137
1142
tm .assert_frame_equal (result , expected )
1138
1143
1139
1144
def test_infer_string_large_string_type (self , tmp_path , pa ):
0 commit comments