Skip to content

Commit a4b68dd

Browse files
committed
Test that pivot warns
1 parent 587e789 commit a4b68dd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pandas/tests/reshape/test_pivot.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ def test_pivot_table(self, observed):
8484
index = ["A", "B"]
8585
columns = "C"
8686
table = pivot_table(
87-
self.data, values="D", index=index, columns=columns, observed=observed
88-
)
87+
self.data, values="D", index=index, columns=columns,
88+
observed=observed)
8989

9090
table2 = self.data.pivot_table(
9191
values="D", index=index, columns=columns, observed=observed
@@ -2075,3 +2075,11 @@ def agg(l):
20752075
)
20762076
with pytest.raises(KeyError, match="notpresent"):
20772077
foo.pivot_table("notpresent", "X", "Y", aggfunc=agg)
2078+
2079+
def test_pivot_table_observed_deprecated_default(self):
2080+
with tm.assert_produces_warning(FutureWarning):
2081+
# make sure we actually have a category to warn on
2082+
self.data.A = self.data.A.astype('category')
2083+
self.data.pivot_table(values="D", index=["A", "B"],
2084+
columns=["C"])
2085+

0 commit comments

Comments
 (0)