**Only Few Seats Left** for Advanced Certification Courses on **Data Science, ML & AI by E&ICT Academy IIT Roorkee**

- Home
- Assessment

There are several mathematical and statistical functions available in NumPy which can be very useful in manipulating the data of a matrix (dataset).

They are as below:

```
import numpy as np
```

**mean()**

Calculates mean of all the elements of the NumPy array, irrespective of the shape of the array.

```
X = np.array( [ [-2.5, 3.1, 7],
[10, 11, 12] ] )
print("mean = ", X.mean())
```

Output will be

6.766666666666667

**var()**

Calculates the variance of the elements of the NumPy array.

```
print("Variance = ", X.var())
```

Output will be

25.855555555555554

**std()**

Calculates the standard deviation of the elements of the NumPy array.

```
print("Standard Deviation = ", X.std())
```

Output will be

5.084835843520964

**min()**

Returns the minimum element in the NumPy array.

```
print("min = ", X.min())
```

Output will be

-2.5

**max()**

Returns the maximum element in the NumPy array.

```
print("max = ", X.max())
```

Output will be

12.0

**sum()**

Returns the sum of the elements of the NumPy array.

```
print("sum = ", X.sum())
```

Output will be

40.6

**prod()**

Returns product of the elements of the NumPy array.

```
print("product = ", X.prod())
```

Output will be

-71610.0

Please follow the below steps:

(1) Please import the required libraries

```
import numpy as np
```

(2) Please create a NumPy array `X_stat`

with values [ [ 1, 2, 3], [ 4, -5, 6] ]

```
<< your code comes here >> = np.array( << your code comes here >> )
```

**mean()**

(3) Please calculate and print the mean of elements of this array `X_stat`

```
print("mean = ", <<your code comes here>>)
```

**var()**

(4) Please calculate and print the variance of elements of this array `X_stat`

```
print("Variance = ", <<your code comes here>>)
```

**std()**

(5) Please calculate and print the standard deviation of elements of this array `X_stat`

```
print("Standard Deviation = ", <<your code comes here>>)
```

**min()**

(6) Please calculate and print the min of elements of this array `X_stat`

```
print("min = ", <<your code comes here>>)
```

**max()**

(7) Please calculate and print the max of elements of this array `X_stat`

```
print("max = ", <<your code comes here>>)
```

**sum()**

(8) Please calculate and print the sum of elements of this array `X_stat`

```
print("sum = ", <<your code comes here>>)
```

**prod()**

(9) Please calculate and print the product of elements of this array `X_stat`

```
print("product = ", <<your code comes here>>)
```

XP

Checking Please wait.

Success

Error

No hints are availble for this assesment

Answer is not availble for this assesment

**Note - **Having trouble with the assessment engine? Follow the steps listed
here

## Loading comments...