Answers for "np.array exists"

3

python check array exists

array = [1,2,3,4]
exists_2 = 2 in array
print(exists_2) # True
exists_5 = 5 in array
print(exists_5) # False
Posted by: Guest on January-29-2021
0

check if a numpy array contains only 1's python

>>> import numpy as np
>>> array=np.array([[1,1,1],[1,1,1],[1,1,1]])
>>> array([[1, 1, 1],
       	   [1, 1, 1],
           [1, 1, 1]])
>>> np.all(array == 1)
>>> True
Posted by: Guest on December-06-2020

Python Answers by Framework

Browse Popular Code Answers by Language