我有一个名为“ vp”的数据框,在某些行中,“ rev”是一个正浮点数,在其他行中,“ rev”不存在(NaN)。
如何将此数据框分成2个部分?我尝试过了
vpbook = vp[vp['rev'] > 0] # works
vpnonbook = vp[~vp['rev'] > 0] # does not work
无效的行将产生:
TypeError: ufunc 'invert' not supported for the input types, and the inputs
could not be safely coerced to any supported types according to the casting
rule ''safe''
该怎么做?