D
D
Daniil Shevkunov2021-06-06 19:27:05
Python
Daniil Shevkunov, 2021-06-06 19:27:05

How to check in numpy array that all values ​​are equal to some number?

there is a 3 by 3 matrix filled with numbers. How to check if all numbers are equal, let's say 7, without looping through the entire matrix?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Dugin, 2021-06-06
@danila763

np.all(matrix == 7)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question