- numpy.where()官方文档
numpy.where(condition[, x, y])
# Return: elements chosen from x or y depending on condition.
功能举例:
df['signal'] = np.where(df['x']>0,1,0)
# 如果x > 0,给signal赋值1,反之赋值0
简化了dataframe条件选择过程。
.
.
.
2019-03-21 18:02:05写于上海
numpy.where(condition[, x, y])
# Return: elements chosen from x or y depending on condition.
功能举例:
df['signal'] = np.where(df['x']>0,1,0)
# 如果x > 0,给signal赋值1,反之赋值0
简化了dataframe条件选择过程。
.
.
.
2019-03-21 18:02:05写于上海