If you take a look at the result of valeur <= 0.6, you can see what’s causing this ambiguity:

>>> valeur <= 0.6
array([ True, False, False, False], dtype=bool)

So the result is another array that has in this case 4 boolean values. Now what should the result be? Should the condition be true when one value is true? Should the condition be true only when all values are true?

That’s exactly what numpy.any and numpy.all do. The former requires at least one true value, the latter requires that all values are true:

>>> np.any(valeur <= 0.6)
True
>>> np.all(valeur <= 0.6)
False
Answer from poke on Stack Overflow
🌐
W3Schools
w3schools.com › python › ref_func_any.asp
Python any() Function
Python Examples Python Compiler ... Python Bootcamp Python Training ... The any() function returns True if any item in an iterable are true, otherwise it returns False....
🌐
Mostly Python
mostlypython.com › using-any
Using `any()`
January 23, 2025 - It feels like I should be able to use the one-liner approach without always going through a round of refactoring. It turns out using any() in the real world is a bit more complicated than it appears on the surface. Python makes it quite straightforward to determine if a specific item appears in a collection.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-any-function
Python any() function - GeeksforGeeks
July 23, 2025 - Python any() function returns True if any of the elements of a given iterable( List, Dictionary, Tuple, set, etc) are True else it returns False.
🌐
Reddit
reddit.com › r/python › using "any" and "all" in python
r/Python on Reddit: Using "any" and "all" in Python
March 29, 2023 - Need to check whether all items in a list match a certain condition? You can use Python's built-in any and all functions for that!
Find elsewhere
🌐
Educative
educative.io › answers › how-and-when-to-use-any-and-all-in-python
How and when to use any() and all() in Python
After: The code is optimized by combining the conditions into a single line using any() for digits and all() for lowercase checks, making the code more concise. Learn the basics with our engaging course! Start your coding journey with our “Learn Python” course, the perfect course for absolute beginners!
🌐
Towards AI
pub.towardsai.net › i-built-an-ai-agent-in-pure-python-heres-what-i-learned-a5b01b02ce79
How to Build an AI Agent in Pure Python: State Machines, Tool Loops, and Verification | Data Science Collective
April 14, 2026 - A practical guide to building a debuggable AI agent in pure Python with explicit state, strict tool contracts, bounded loops, and answer verification.
🌐
Python Morsels
pythonmorsels.com › any-and-all
Python's any() and all() functions - Python Morsels
March 29, 2023 - The any function checks for the truthiness of each item in a given iterable, but we need something a little more than that: we need to check a condition on each element. Specifically, we need to check whether a number is between 0 and 5. Python ...
🌐
Project Shop
projectshop.in › home › blog › understanding a.any() and a.all() in python
Understanding a.any() and a.all() in Python - Project Shop
June 21, 2024 - The a.any() function is useful when you want to check if any element in an array meets a certain condition.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-numpy-numpy-matrix-any
Python | Numpy numpy.matrix.any() - GeeksforGeeks
April 8, 2019 - Syntax : numpy.matrix.any() Return : Return true if any match found else false Example #1 : In this example we can see that with the help of matrix.any() method, we are able to compare any two matrix having different dimensions and if any match found then return true. ... # import the important module in python import numpy as np # make a matrix with numpy gfg1 = np.matrix('[1, 2, 3, 4]') gfg2 = np.matrix('[1, 2]') # applying matrix.any() method geeks = (gfg1 == gfg2).any() print(geeks)
🌐
ashwinsharmap
ashwinsharmap.hashnode.dev › any-and-all-in-python
any() and all() in Python
January 7, 2021 - In this post, we will be looking into any() and all() functions in Python. First, let us discuss the any() function. 👉 any() The any() function takes an iterable as an argument : any(iterable) . The iterable can be a list, tuple or dictionary. ...
🌐
freeCodeCamp
freecodecamp.org › news › python-any-and-all-functions-explained-with-examples
Python any() and all() Functions – Explained with Examples
August 10, 2021 - As shown in the code snippet below, our example string coding**is**cool**345 contains digits. Therefore, calling any() function on the string should return True.
🌐
PythonAnywhere
pythonanywhere.com
Host, run, and code Python in the cloud: PythonAnywhere
Take your development environment with you! If you have a browser and an Internet connection, you've got everything you need. ... PythonAnywhere is a fully-fledged Python environment, ready to go, for students and teachers — concentrate on teaching, not on installation hassles.
🌐
Plain English
python.plainenglish.io › pythons-any-and-all-functions-explained-90a89b1b4348
Python’s any() and all() Functions Explained | by Durgesh Samariya | Python in Plain English
September 21, 2023 - When working with lists, tuples, or other iterable data structures in Python, you might encounter scenarios where you need to check whether any or all elements meet a certain condition. Python provides two built-in functions, any() and all(), that make these checks simple and efficient.
🌐
Python Pool
pythonpool.com › home › blog › numpy any | comprehensive showcase of boolean analyser
Numpy any | Comprehensive Showcase of Boolean Analyser - Python Pool
June 14, 2021 - This is also a boolean function in the numpy module, like numpy any. This returns True only if all values are 1 or True or non zero or NaN. This is just the opposite of numpy any. numpy any is based on any function used in basic Python.
🌐
HowToDoInJava
howtodoinjava.com › home › python built-in functions › python any() function
Python any() Function
October 2, 2022 - Python any() function returns True if at least one element of an iterable is True. If no element in iterable is True, any() returns False.