import numpy as np
a = np.array([1, 0, np.nan, np.inf])
print("Original array")
print(a)
print("Test a given array element-wise for finiteness :")
print(np.isfinite(a))
Sample Output:
Original array
[ 1. 0. nan inf]
Test a given array element-wise for finiteness :
[ True True False False]
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer