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....
🌐
Programiz
programiz.com › python-programming › methods › built-in › any
Python any()
Created with over a decade of experience and thousands of feedback. ... The any() function returns True if any element of an iterable is True. If not, it returns False. ... The any() function takes an iterable (list, string, dictionary etc.) in Python.
🌐
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.
🌐
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.
🌐
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.
🌐
Real Python
realpython.com › any-python
How to Use any() in Python – Real Python
February 18, 2022 - In the above example, you check each applicant’s credentials and schedule an interview if the applicant meets any of your three criteria. Technical Detail: Python’s any() and or aren’t limited to evaluating Boolean expressions. Instead, Python performs a truth value test on each argument, evaluating whether the expression is truthy or falsy.
Find elsewhere
🌐
DataCamp
datacamp.com › tutorial › python-any-function
Python any() Function: Guide With Examples and Use Cases | DataCamp
July 31, 2024 - Python's any() is one of the built-in functions. It accepts an iterable such as a list or tuple, and it returns True if at least one value in the iterable is truthy. A truthy value is evaluated as True when cast to a Boolean using bool().
🌐
Real Python
realpython.com › ref › builtin-functions › any
any() | Python’s Built-in Functions – Real Python
Suppose you need a function to decide whether to send a notification to a user based on multiple criteria like unread messages, pending tasks, or upcoming events: ... >>> def should_notify(unread_messages, pending_tasks, upcoming_events): ... return any([ ...
🌐
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 ...
🌐
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!
🌐
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!
🌐
Note.nkmk.me
note.nkmk.me › home › python
How to Use all() and any() in Python | note.nkmk.me
May 12, 2025 - In Python, you can use the built-in functions all() and any() to check whether all elements or at least one element in an iterable (such as a list or tuple) evaluate to True. Built-in Functions - all( ...
🌐
Codecademy
codecademy.com › docs › python › built-in functions › any()
Python | Built-in Functions | any() | Codecademy
April 27, 2023 - The any() built-in function takes in an iterable object such as a list or tuple and returns True if any of the elements in the iterable are true. If none of the elements present in the iterable are true, any() will return False.
🌐
Tutorialspoint
tutorialspoint.com › python › python_any_function.htm
Python any() Function
The Python any() function is a built-in function that returns True if any of the elements of a given iterable, such as a list, tuple, set, or dictionary is truthy, otherwise, it returns False.
🌐
Scaler
scaler.com › home › topics › any() in python | python any() function
any() in Python | Python any() Function - Scaler Topics
March 15, 2022 - Let us dive into the example below to understand the concept explained above. ... The any() in python returns the output as True if any one of the elements in the given iterable object is True.
🌐
Stack Abuse
stackabuse.com › any-and-all-in-python-with-examples
any() and all() in Python with Examples
September 11, 2023 - The any(iterable) and all(iterable) are built-in functions in Python and have been around since Python 2.5 was released. Both functions are equivalent to writing a series of or and and operators respectively between each of the elements of the passed iterable.
🌐
Wiingy
wiingy.com › home › learn › python › any() and all() functions in python
Any() and All() Functions in Python (With Examples) - Wiingy
January 30, 2025 - The any() function takes an iterable object (e.g. a list, tuple, or set) as an argument and returns True if at least one element in the iterable object is True. Otherwise, it returns False. ... The any() function can be used to check if a string contains any digits.