我有一个熊猫小组:
Items axis: X1 to X3
Major_axis axis: (1973-09-30 00:00:00, 1989-03-31 00:00:00) to (2015-07-31 00:00:00, 2015-08-21 00:00:00)
Minor_axis axis: A to C
我希望将它转换为具有多级列(Item,Minor)的数据帧,多级列看起来如下:
mi_tuples = [ ('A','X1'), ('A','X2'), ('A','X3'), ('B','X1'), ('B','X2'), ('B','X3'), ('C','X1'), ('C','X2'), ('C','X3') ]
mi_columns = pd.MultiIndex.from_tuples(mi_tuples, names = ['minor', 'items'])
有什么想法吗?
谢谢!