我有一个小组:
<class 'pandas.core.panel.Panel'>
Dimensions: 5 (items) x 6 (major_axis) x 10 (minor_axis)
Items axis: alpha= 00.0 to alpha= 14.0
Major_axis axis: 0 to 5
Minor_axis axis: Ca force to force
在每个Panel ['alpha = xx.x']中,我有一个名为'force'的字段(不是索引)。
我如何从Panel中提取一个子面板仅选择(例如)['alpha = 00.0','alpha = 02.0']以及force在[0.0,1000。,]中的所有行? / p>
编辑:
>>>Panel.items
Index([u'alpha= 02.0', u'alpha= 04.0', u'alpha= 06.0', u'alpha= 08.0', u'alpha= 10.0', u'alpha= 12.0', u'alpha= 13.0', u'alpha= 14.0'])
>>>Panel['alpha= 06.0'] #and all other DataFrame are similar
Cn tot Force
0 0.745853 0
1 0.836990 500
2 0.912409 1000
3 1.033221 2000
4 1.581379 10000
5 1.825051 15000
就是这种情况。我想要的是创建一个新的面板,例如:
>>> Panel_new.items
Index(['alpha= 06.0', u'alpha= 10.0'])
>>>Panel_new['alpha= 06.0'] # #and all other DataFrame are similar
Cn tot Force
0 0.745853 0
1 0.912409 1000
让我知道是否清楚。
答案 0 :(得分:0)
subidx = ['alpha = 06.0','alpha = 10.0']
Panel_new = Panel.ix [subidx]
这应该对你有用