numpy basic
1.Write a NumPy program to get the numpy version and show numpy build configuration.
np.__version__
np.show_config()
2. Write a NumPy program to get help on the add function.
np.info(np.add)
3. Write a NumPy program to test whether none of the elements of a given array is zero.
x = np.array([1, 2, 3, 4])
np.all(x)
4. Write a NumPy program to test whether any of the elements of a given array is non-zero.
np.any(x)
5. Write a NumPy program to test a given array element-wise for finiteness (not infinity or not a Number).
x = np.array([1, 2, np.nan, np.inf])
np.isfinite(x)
6. Write a NumPy program to test element-wise for positive or negative infinity.
np.isinf(x)
7. Write a NumPy program to test element-wise for NaN of a given array.
np.isnan(x)
8. Write a NumPy program to test element-wise for complex number, real number of a given array. Also test whether a given number is a scalar type or not.
np.iscomplex()
np.isreal()
np.isscalar()
np.isscalar(3.1) True
np.isscalar([3.1]) False