numpy.logical_and()

numpy.logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'logical_and'>

Compute the truth value of x1 AND x2 element-wise.

Parameters:

x1, x2 : array_like Input arrays. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output). out : ndarray, None, or tuple of ndarray and None, optional A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs. where : array_like, optional This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized. **kwargs For other keyword-only arguments, see the ufunc docs.

Returns:

y : ndarray or bool Boolean result of the logical OR operation applied to the elements of x1 and x2; the shape is determined by broadcasting. This is a scalar if both x1 and x2 are scalars.

See also

logical_or, logical_not, logical_xor, bitwise_and

Examples

>>> np.logical_and(True, False)
False
>>> np.logical_and([True, False], [False, False])
array([False, False])

>>> x = np.arange(5)
>>> np.logical_and(x>1, x<4)
array([False, False,  True,  True, False])

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • Python 多版本管理利器 pythonbrew

    pythonbrew是受 perlbrew 和 rvm 启发,在用户的$HOME目录中进行python构建和安装自动化的项目。

    小小科
  • 02-Shell-脚本多种执行方式

    [root@node1 ~]# chmod o+x first.sh

    泽阳
  • 从挖矿木马看后渗透维权

    由于传播、利用此文所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责,雷神众测以及文章作者不为此承担任何责任。 雷神众测拥有对此文章的修改和...

    安恒网络空间安全讲武堂
  • 05-Shell-位置变量与预定义变量

    $* : 以一个单字符串显示所有向脚本传递的参数。与位置变量不同,此选项参数可超过 9个

    泽阳
  • 万字长文总结机器学习的模型评估与调参

    选自 Python-Machine-Learning-Book On GitHub

    Sam Gor
  • 教你几个有趣又好玩的 Linux 命令

    -a An accident seems to happen. You'll feel pity for people who cry for help.

    一个优秀的废人
  • 优雅地在Mac OS Catalina下 编译 Open JDK 13

    通过Mercurial代码管理版本管理工具从Repository中直接获取源码(Repository为http://hg.openjdk.java.net)

    JavaEdge
  • CVE-2019-14287 linux sudo root 权限绕过漏洞复现

    2019年10月14日,Sudo官方发布了Sudo 1.8.28版本,其中包含sudo root权限绕过漏洞的补丁修复。

    墙角睡大觉
  • 给网站配置免费的HTTS证书

    最近看到网上说 https 的网站 Google 会优先收录,所以就抽时间记录下配置博客的过程。

    搜云库技术团队
  • Ubuntu16.04获取内核源码

    没有下载内核源码时,只有四个文件夹 linux-header-4.10.0-28 和 linux-headers-4.10.0-28-generic ;

    随心助手

扫码关注云+社区

领取腾讯云代金券