I would like that when viewing my DataFrame I will see all values of the multiIndex, including when subsequent rows have the same index for one of the levels. Here is an example:
arrays = [['20', '50', '20', '20'],['N/A', 'N/A', '10', '30']]
tuples = list(zip(*arrays))
index = pd.MultiIndex.from_tuples(tuples, names=['Jim', 'Betty'])
pd.DataFrame([np.random.rand(1)]*4,index=index)
The output is:
0
Jim Betty
20 N/A 0.954973
50 N/A 0.954973
20 10 0.954973
30 0.954973
I would like to have a 20 also in the south-west corner. That is, I would like my DataFrame to be:
0
Jim Betty
20 N/A 0.954973
50 N/A 0.954973
20 10 0.954973
20 30 0.954973
Is Pandas capable of doing that?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…