我试图在两个条件语句中使用np.where,但我得到了
ValueError:系列的真相是模棱两可的。使用a.empty、a.bool()、a.item()、a.any()或a.all()。
我的代码如下所示:
df[column4'] = np.where(df['column1'] > df['column2'] and df['column1'] > df['column3'], df['column1'], np.nan)我和“&”和“操作员”都试过了,但都没有用。
知道我在这里做错了什么吗?谢谢!
发布于 2020-07-04 02:45:14
你应该把这种情况像
df['column4'] = np.where((df['column1'] > df['column2']) & (df['column1'] > df['column3']), df['column1'], np.nan)https://stackoverflow.com/questions/62724729
复制相似问题