Write a NumPy program to test whether specified values are present in an array.
import numpy as np x = np.array([[1.12, 2.0, 3.45], [2.33, 5.12, 6.0]], float) print("Original array:") print(x) print(2 in x) print(0 in x) print(6 in x) print(2.3 in x) print(5.12 in x)
Sample Output:
Original array: [[ 1.12 2. 3.45] [ 2.33 5.12 6. ]] True False True False True
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer