我想创建一个新列,如果多个列有nan值,则添加数字1。但是,当我运行我编写的代码时,我不断遇到一条错误消息
df_test2['notsure']=np.where((df_test2[df_test2[['android','blackberry','chrome_os','linux',
'macintosh','tizen','windows_phone','windows',
'ipad','iphone','device_other']].isna().any(1)]),1,0)
错误消息:
ValueError: Length of values does not match length of index
以下是必要的按嵌套列表筛选:
另一种方法是将布尔掩码转换为
True/False
到1,0
映射的整数:相关问题 更多 >
编程相关推荐