如果条件使用 Python

If condition using Python

能否请您帮我使用 Python 从 table 生成第三列?我尝试使用 numpy.where 选项,但无法获得所需的输出。

我的table:

我试过代码

 db['Condition'] = numpy.where(db.Value <50, 'Less than 50', db.Value <100, 'Less than 100','more than 100'). 

这里的db指的是数据库名。我收到的错误消息

TypeError: where() takes at most 3 arguments (5 given)

根据 numpy.where 文档,它只需要 3 个参数,条件和 x(如果为真),y(如果为假)array_like。要获得所需的输出:

db['Condition'] = numpy.where(db['Value'] < 50, 'Less than 50', numpy.where(db['Value']<100, 'Less than 100','More than 100'))