Skip to content

Commit ebdba9c

Browse files
added tests for int64
1 parent 6a7685f commit ebdba9c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pandas/tests/reshape/test_pivot.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,17 +2376,20 @@ def test_pivot_table_with_margins_and_numeric_columns(self):
23762376

23772377
tm.assert_frame_equal(result, expected)
23782378

2379-
def test_pivot_ea_dtype_dropna(self, dropna):
2379+
@pytest.mark.parametrize("dtype",['Int64','int64'])
2380+
def test_pivot_ea_dtype_dropna(self, dropna,dtype):
23802381
# GH#47477
2381-
df = DataFrame({"x": "a", "y": "b", "age": Series([20, 40], dtype="Int64")})
2382+
# GH#47971
2383+
df = DataFrame({"x": "a", "y": "b", "age": Series([20, 40], dtype=dtype)})
23822384
result = df.pivot_table(
23832385
index="x", columns="y", values="age", aggfunc="mean", dropna=dropna
23842386
)
2387+
expected_dtype = "float64" if dtype=="int64" else "Float64"
23852388
expected = DataFrame(
23862389
[[30]],
23872390
index=Index(["a"], name="x"),
23882391
columns=Index(["b"], name="y"),
2389-
dtype="Float64",
2392+
dtype=expected_dtype,
23902393
)
23912394
tm.assert_frame_equal(result, expected)
23922395

0 commit comments

Comments
 (0)