Write a NumPy program to test element-wise for positive or negative infinity
import numpy as np a = np.array([1, 0, np.nan, np.inf]) print("Original array") print(a) print("Test element-wise for positive or negative infinity:") print(np.isinf(a))
Sample Output:
Original array [ 1. 0. nan inf] Test element-wise for positive or negative infinity: [False False 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