Skip to content

Commit 984b7d6

Browse files
used pytest.mark.parametrize for expected_dtype
1 parent 1f25150 commit 984b7d6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pandas/tests/reshape/test_pivot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,15 +2376,16 @@ def test_pivot_table_with_margins_and_numeric_columns(self):
23762376

23772377
tm.assert_frame_equal(result, expected)
23782378

2379-
@pytest.mark.parametrize("dtype", ["Int64", "int64"])
2380-
def test_pivot_ea_dtype_dropna(self, dropna, dtype):
2379+
@pytest.mark.parametrize(
2380+
"dtype,expected_dtype", [("Int64", "Float64"), ("int64", "float64")]
2381+
)
2382+
def test_pivot_ea_dtype_dropna(self, dropna, dtype, expected_dtype):
23812383
# GH#47477
23822384
# GH#47971
23832385
df = DataFrame({"x": "a", "y": "b", "age": Series([20, 40], dtype=dtype)})
23842386
result = df.pivot_table(
23852387
index="x", columns="y", values="age", aggfunc="mean", dropna=dropna
23862388
)
2387-
expected_dtype = "float64" if dtype == "int64" else "Float64"
23882389
expected = DataFrame(
23892390
[[30]],
23902391
index=Index(["a"], name="x"),

0 commit comments

Comments
 (0)