参考链接: 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=True) 功能...参数: cond 查找条件 other cond为False时要替换的值 inplace 是否在原数据上操作
>>> import numpy as np
>>> import pandas as pd...dtype=int64), array([1, 2, 3, 4, 0, 1, 2, 3, 4], dtype=int64))
具体实现
numpy.where(condition[, x, y]) 功能...那么,当condition中的值是true时返回x对应位置的值,false是返回y的。