参考链接: Python中的numpy.place
注意: df1.where(cond,df2) 等价于 np.where(cond, df1, df2)
1. pandas.DataFrame.where...2 8 9 10 11
>>> data.where(data['a']>3, 3.0)
a b c d
0 3 3 3 3
1 4 5 6 7
2 8...>>> import numpy as np
>>> a = np.arange(10)
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> np.where...,bool 值)x,y(可选): x 和 y 的 shape 必须和 condition 相同(可以采用 broadcast,广播机制) ①如果参数有condition,x和y,它们三个参数的shape...行和列
(array([2, 2, 2], dtype=int64), array([0, 1, 2], dtype=int64))
https://www.cnblogs.com/zz22–/p/8654395