Skip to content

Commit 913baa7

Browse files
committed
Explain the logic of the fix
1 parent c81c478 commit 913baa7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pandas/core/reshape/pivot.py

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ def pivot_table(data, values=None, index=None, columns=None, aggfunc='mean',
148148

149149
table = agged
150150
if table.index.nlevels > 1:
151+
# If index_names are integers, determine whether the integers refer
152+
# to the level position or name
151153
index_names = agged.index.names[:len(index)]
152154
to_unstack = []
153155
for i in range(len(index), len(keys)):

0 commit comments

Comments
 (0)