[issue26596] numpy.all np.all .all

Eryk Sun report at bugs.python.org
Sun Mar 20 20:06:33 EDT 2016


Eryk Sun added the comment:

NumPy is not part of Python's standard library, so this is a 3rd party problem. However, please don't waste the time of the NumPy developers with this. You either haven't read the documentation or have misread it. numpy.all [1] is an AND reduction over the specified dimension or all dimensions of an array.

    >>> import numpy as np
    >>> A = np.random.random((10, 1))
    >>> np.all(A)
    True
    >>> True < 1
    False
    >>> isinstance(True, int)
    True
    >>> int(True)
    1

The following checks whether all values are less than 1:

    >>> A < 1
    array([[ True],
           [ True],
           [ True],
           [ True],
           [ True],
           [ True],
           [ True],
           [ True],
           [ True],
           [ True]], dtype=bool)
    >>> np.all(A < 1)
    True

[1]: http://docs.scipy.org/doc/numpy/reference/generated/numpy.all.html

----------
nosy: +eryksun
resolution:  -> third party
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26596>
_______________________________________


More information about the Python-bugs-list mailing list