我有一个具有以下特征的数据集。3个指标。两层柱面。
每个索引有两行数据。
这就是说,我试图筛选一列值大于0.7的行,但只收到索引错误。
我的数据帧如下
indx=['nmatch','pts','gfa','gco','cs','fts','bts','o25%','po25/bts']
findx=[('fecha',''),('torneo',''),('partido','')]+[('h/a stats',x) for x in indx]+[('total stats',y) for y in indx]
index=pd.MultiIndex.from_tuples(findx, names=['tipo', 'stat'])
fframe=pd.DataFrame(l,columns=index)
fframe.set_index(['fecha','torneo','partido'],inplace=True)
如果我这样做
fframe[fframe[('h/a stats','po25/bts')]>0.7]
我有点像
date trophy match data
A B ganma v theta True
A B ganma v theta False
F B Etha v psi True
F B Etha v psi True
C D epsilon v mu False
C D epsilon v mu False
如果我这样做
ind=fframe.index[f[('h/a stats','po25/bts')]>0.7]
我得到了它的索引,但是当我这样做的时候
fframe.loc[ind]
>IndexError: list index out of range
我希望索引是唯一的,而不是4b应该只有一个b,而不是2个匹配应该只有一个。
但主要的是,我想得到一个包含所有真行的框架,如果发生像甘玛vθ这样的情况,其中一行是真的,另一行是假的,来显示这两行