pandas Displaying all elements in the index


Example

To view all elements in the index change the print options that “sparsifies” the display of the MultiIndex.

pd.set_option('display.multi_sparse', False)
df.groupby(['A','B']).mean()
# Output:
#        C
# A B
# a 1  107
# a 2  102
# a 3  115
# b 5   92
# b 8   98
# c 2   87
# c 4  104
# c 9  123