前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >使用np.where()

使用np.where()

作者头像
羽翰尘
修改2019-11-26 15:44:43
4510
修改2019-11-26 15:44:43
举报
文章被收录于专栏:技术向技术向

本文由腾讯云+社区自动同步,原文地址 http://blogtest.stackoverflow.club/use-np-where/

import: use & instead of and

Simply, use np.where(condition1 & condition2) will get the right answer,

but `np.where( list(condition1) and list(condition2)) won’t return the right answer.

So, please use &.

Further disscus

Try this python script:

代码语言:txt
复制
a = [True, False, False]
b = [False, True, True]
print('a and b', a and b)

You will get:

代码语言:txt
复制
a anb [False, True, True]

Reference:

  1. numpy进阶:多条件查找 http://blog.sina.com.cn/s/blog_12c3192a50102xd5z.html
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018-04-12,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • import: use & instead of and
  • Further disscus
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档