## Python Aggregations functions program

First, we have to import Numpy as import numpy as np. To make a Numpy array, you can just use the np.array() function. The aggregate and statistical functions are given below:

1.     np.sum(m): Used to find out the sum of the given array.
2.     np.prod(m): Used to find out the product(multiplication) of the values of m.
3.     np.mean(m): It returns the mean of the input array m.
4.     np.std(m): It returns the standard deviation of the given input array m.
5.     np.var(m): Used to find out the variance of the data given in the form of array m.
6.     np.min(m): It returns the minimum value among the elements of the given array m.
7.     np.max(m): It returns the maximum value among the elements of the given array m.
8.     np.argmin(m): It returns the index of the minimum value among the elements of the array m.
9.     np.argmax(m): It returns the index of the maximum value among the elements of the array m.
10.     np.median(m): It returns the median of the elements of the array m.

The code using the above all the function is given below:

```import numpy as np
a=np.array([1,2,3,4,5])
print("a :",a)
sum=np.sum(a)
print("sum :",sum)
product=np.prod(a)
print("product :",product)
mean=np.mean(a)
print("mean :",mean)
standard_deviation=np.std(a)
print("standard_deviation :",standard_deviation)
variance=np.var(a)
print("variance :",variance)
minimum=np.min(a)
print("minimum value :",minimum)
maximum=np.max(a)
print("maximum value :",maximum)
minimum_index=np.argmin(a)
print("minimum index :",minimum_index)
maximum_index=np.argmax(a)
print("maximum-index :",maximum_index)
median=np.median(a)
print("median :",median)

```

Output

```a : [1 2 3 4 5]
sum : 15
product : 120
mean : 3.0
standard_deviation : 1.4142135623730951
variance : 2.0
minimum value : 1
maximum value : 5
minimum index : 0
maximum-index : 4
median : 3.0```

More

More

More

More

More

More
Top