根据索引值的布尔值过滤数据帧

时间:2019-01-17 00:28:26

标签: python pandas

熊猫的新手,我想我缺少关于数据帧的一些基本知识。

e=pd.DataFrame(data={'a':[1,1,2,2,3,3],'b':[7,8,9,10,11,12],'c':[20,21,22,23,24,25]}).set_index(['a','c'])

如何根据索引a大于2来过滤此数据帧?

e.query('"a" > 2')

给我

'>' not supported between instances of 'list' and 'int'

0 个答案:

没有答案
相关问题