Skip to content

Commit e2ec0d5

Browse files
more test updates
1 parent 8abe052 commit e2ec0d5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pandas/tests/io/test_parquet.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,10 +1117,12 @@ def test_string_inference(self, tmp_path, pa):
11171117
df.to_parquet(path, engine="pyarrow")
11181118
with pd.option_context("future.infer_string", True):
11191119
result = read_parquet(path, engine="pyarrow")
1120+
dtype = pd.StringDtype(na_value=np.nan)
11201121
expected = pd.DataFrame(
11211122
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),
11241126
)
11251127
tm.assert_frame_equal(result, expected)
11261128

@@ -1133,7 +1135,10 @@ def test_roundtrip_decimal(self, tmp_path, pa):
11331135
df = pd.DataFrame({"a": [Decimal("123.00")]}, dtype="string[pyarrow]")
11341136
df.to_parquet(path, schema=pa.schema([("a", pa.decimal128(5))]))
11351137
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")
11371142
tm.assert_frame_equal(result, expected)
11381143

11391144
def test_infer_string_large_string_type(self, tmp_path, pa):

0 commit comments

Comments
 (0)