Showing all index values when using multiIndexing in Pandas

You need set display.multi_sparse to False:

#if need temporary use option
with pd.option_context('display.multi_sparse', False):
    print (df)

                  0
Jim Betty          
20  N/A    0.201643
50  N/A    0.201643
20  10     0.201643
20  30     0.201643

If this display option is required throughout a notebook, the option can be set once and for all as follows:

# if permanent use
import pandas as pd
pd.options.display.multi_sparse = False

Documentation:

display.multi_sparse
True
“Sparsify” MultiIndex display (don’t display repeated elements in outer levels within groups)

Leave a Comment