I have DataFrame like below:
df = pd.DataFrame({"ID" : ["1", "1", "1", "2", "3"], "value" : [10, 11, 12, 13, 14]})
df.set_index(["ID", "value"], inplace=True)
By doing so I have multiindex "ID" and "value" like below:
What can I do so as to have this multiindex like on the result like below:
I tried also other way on the data frame like below:
df = pd.DataFrame({"ID" : ["1", "1", "1", "2", "3"], "value" : [10, 11, 12, 13, 14], "a} : [1,2,3,4,5)
df.set_index(["ID", "value"], inplace=True)
And code:
#temporaly display all levels of MultiIndex
with pd.option_context('display.multi_sparse',False):
print (df)
But result is not a "elegant" DataFrame


