参考链接: Python中的numpy.place
注意: df1.where(cond,df2) 等价于 np.where(cond, df1, df2)
1. pandas.DataFrame.where...
DataFrame.where(cond, other=nan, inplace=False, axis=None, level=None, try_cast=False, raise_on_error...(data['a']>3, 3.0)
a b c d
0 3 3 3 3
1 4 5 6 7
2 8 9 10 11
2.numpy.where
声明:...首先强调一下,where()函数对于不同的输入,返回值是不同的。
...那么,当condition中的值是true时返回x对应位置的值,false是返回y的。