我有单列的多索引数据框。我想基于该数据帧绘制堆积条形图。数据如下:
df= pd.DataFrame(index=pd.MultiIndex([[1,2,3],['open','closed']],[[0,0,1,1,2,2],[0,1,0,1,0,1]]))
df['id']=[23,6,12,4,31,16]
df
id
state
1 closed 23
open 6
2 closed 12
open 4
3 closed 31
open 16