NumPy Aggregate and Statistical Functions
Functions | Description |
---|---|
np.mean() | Compute the arithmetic mean along the specified axis. |
np.std() | Compute the standard deviation along the specified axis. |
np.var() | Compute the variance along the specified axis. |
np.sum() | Sum of array elements over a given axis. |
np.prod() | Return the product of array elements over a given axis. |
np.cumsum() | Return the cumulative sum of the elements along a given axis. |
np.cumprod() | Return the cumulative product of elements along a given axis. |
np.min(), np.max() | Return the minimum / maximum of an array or minimum along an axis. |
np.argmin(), np.argmax() | Returns the indices of the minimum / maximum values along an axis |
np.all() | Test whether all array elements along a given axis evaluate to True. |
np.any() | Test whether any array element along a given axis evaluates to True. |
import numpy as np array1 = np.array([[10, 20, 30], [40, 50, 60]]) print("Mean: ", np.mean(array1)) print("Std: ", np.std(array1)) print("Var: ", np.var(array1)) print("Sum: ", np.sum(array1)) print("Prod: ", np.prod(array1))
Sample output of above program.
Mean: 35.0
Std: 17.07825127659933
Var: 291.6666666666667
Sum: 210
Prod: 720000000
2019-02-18T18:27:39+05:30
2019-02-18T18:27:39+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution