我对Python/Pandas相对较新,并且很努力从pd.Dataframe中提取正确的数据。我实际上有与3列的数据帧:从熊猫Dataframe中提取在特定列中具有特定值的所有行
data =
Position Letter Value
1 a TRUE
2 f FALSE
3 c TRUE
4 d TRUE
5 k FALSE
我想要做的就是把所有真行到一个新的数据帧,这样的答案是什么:
answer =
Position Letter Value
1 a TRUE
3 c TRUE
4 d TRUE
我知道您可以访问特定列使用
data['Value']
但我如何提取所有TRUE行?
感谢您的帮助和建议,
亚历
可能重复[?如何通过“内”,“在” /筛选大熊猫的数据帧行(http://stackoverflow.com/问题/ 12065885/how-to-filter-the-dataframe-rows-of-pandas-by-in-in) – DontDivideByZero