参考链接: 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()函数对于不同的输入,返回值是不同的。
...>>> import numpy as np
>>> a = np.arange(10)
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> np.where