(df, pdf, aggfunc)
| 29 | |
| 30 | @pytest.mark.parametrize("aggfunc", ["first", "last", "sum", "mean", "count"]) |
| 31 | def test_pivot_table(df, pdf, aggfunc): |
| 32 | assert_eq( |
| 33 | df.pivot_table(index="x", columns="y", values="z", aggfunc=aggfunc), |
| 34 | pdf.pivot_table( |
| 35 | index="x", columns="y", values="z", aggfunc=aggfunc, observed=False |
| 36 | ), |
| 37 | check_dtype=aggfunc != "count", |
| 38 | ) |
| 39 | |
| 40 | assert_eq( |
| 41 | df.pivot_table(index="x", columns="y", values=["z", "a"], aggfunc=aggfunc), |
| 42 | pdf.pivot_table( |
| 43 | index="x", columns="y", values=["z", "a"], aggfunc=aggfunc, observed=False |
| 44 | ), |
| 45 | check_dtype=aggfunc != "count", |
| 46 | ) |
| 47 | |
| 48 | assert_eq( |
| 49 | pivot_table(df, index="x", columns="y", values=["z", "a"], aggfunc=aggfunc), |
| 50 | pdf.pivot_table( |
| 51 | index="x", columns="y", values=["z", "a"], aggfunc=aggfunc, observed=False |
| 52 | ), |
| 53 | check_dtype=aggfunc != "count", |
| 54 | ) |
| 55 | |
| 56 | |
| 57 | def test_pivot_table_fails(df): |
nothing calls this directly
no test coverage detected