Python 3.x 2参数numpy where函数

Python 3.x 2参数numpy where函数,python-3.x,pandas,numpy,boolean-logic,Python 3.x,Pandas,Numpy,Boolean Logic,我想为numpy中的where函数提供两个参数,但我知道我的逻辑中存在某种错误。对于一个参数,我希望它有一列大于0,并从另一列中选择具有空白实体的相同索引 august_report['Subsidy'] = np.where((august_report['Contract Renewal'] > 0)&(august_report['Transaction Types']== "NaN"), '1','0') 请尝试以下方法: august_report['Subsidy']

我想为
numpy
中的where函数提供两个参数,但我知道我的逻辑中存在某种错误。对于一个参数,我希望它有一列大于
0
,并从另一列中选择具有空白实体的相同索引

august_report['Subsidy'] = np.where((august_report['Contract Renewal'] > 0)&(august_report['Transaction Types']== "NaN"), '1','0')
请尝试以下方法:

august_report['Subsidy'] = np.where((august_report['Contract Renewal'] > 0)&(august_report['Transaction Types'].isnull()), '1','0')

当前代码以字符串而不是空值搜索
'NaN'

august_report['Subsidy'] = np.where((august_report['Contract Renewal'] > 0)&(august_report['Transaction Types'] == ''), '1','0')