Skip to content

Commit de54697

Browse files
committed
Add second test case for only columns/value
1 parent 9041b48 commit de54697

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/reshape/test_pivot.py

+10
Original file line numberDiff line numberDiff line change
@@ -2566,6 +2566,7 @@ def test_pivot_with_categorical(self, dropna):
25662566
"Val": range(1, 6),
25672567
}
25682568
)
2569+
# case with index/columns/value
25692570
result = df.pivot_table(index="In", columns="Col", values="Val")
25702571

25712572
expected_cols = pd.CategoricalIndex(["A", "B"], ordered=True, name="Col")
@@ -2579,3 +2580,12 @@ def test_pivot_with_categorical(self, dropna):
25792580
)
25802581

25812582
tm.assert_frame_equal(result, expected)
2583+
2584+
# case with columns/value
2585+
result = df.pivot_table(columns="Col", values="Val")
2586+
2587+
expected = pd.DataFrame(
2588+
data=[[3.5, 3.0]], columns=expected_cols, index=Index(["Val"])
2589+
)
2590+
2591+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)