[英]Pandas: return dataframe where one column's values are greater than another
Apologies if this is a duplicate but I can't seem to find a working example in the pandas docs, SO or google. 如果这是重复的道歉,但我似乎无法在pandas docs,SO或google中找到一个有效的例子。
How do you return a dataframe where the values of one column are greater than the values of another? 如何返回一列的值大于另一列的值的数据帧?
Should be something like this: df['A'].where(df['A']>df['B'])
应该是这样的: df['A'].where(df['A']>df['B'])
But this returns only a vector. 但这只返回一个向量。 I need the full filtered dataframe. 我需要完整的过滤数据帧。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.