Answers for "check odd numbers numpy"

1

check odd numbers numpy

# Input
arr = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
arr[arr % 2 == 1]
#> array([1, 3, 5, 7, 9])
Posted by: Guest on November-11-2020

Python Answers by Framework

Browse Popular Code Answers by Language