Answers for "numpy if zero is present"

0

numpy if zero is present

import numpy
array = np.array([0.  , 0.05, 0.25, 0.5 , 0.75])
# is array contain no 0?
np.all(array)
>>> False
# Remove the 0, first element of the array.
array[1:]
>>> array([0.05, 0.25, 0.5 , 0.75])
# is array contain no 0?
np.all(array[1:])
>>> True
Posted by: Guest on August-05-2021

Python Answers by Framework

Browse Popular Code Answers by Language