# Summary statistics¶

In descriptive statistics, summary statistics are used to summarize a set of observations, in order to communicate the largest amount of information as simply as possible. Statisticians commonly try to describe the observations in

- a measure of location, or central tendency, such as the arithmetic mean.
- a measure of statistical dispersion like the standard deviation.
- a measure of the shape of the distribution like skewness or kurtosis.
- if more than one variable is measured, a measure of statistical dependence such as a correlation coefficient.

NumPy has quite a few useful statistical functions for calculating **sum**, **mean**, **standard deviation** and **variance**, etc. from the given elements in the array.

## Hands on!¶

In [ ]:

```
import sys
import numpy as np
```

### Summary statistics¶

In [ ]:

```
a = np.array([1, 2, 3, 4])
```

In [ ]:

```
a.shape
```

In [ ]:

```
a.sum()
```

In [ ]:

```
a.mean()
```

In [ ]:

```
a.std()
```

In [ ]:

```
a.var()
```

In [ ]:

```
A = np.array([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
])
```

In [ ]:

```
A.sum()
```

In [ ]:

```
A.mean()
```

In [ ]:

```
A.std()
```

In [ ]:

```
A.sum(axis=0)
```

In [ ]:

```
A.sum(axis=1)
```

In [ ]:

```
A.mean(axis=0)
```

In [ ]:

```
A.mean(axis=1)
```

In [ ]:

```
A.std(axis=0)
```

In [ ]:

```
A.std(axis=1)
```

#### Cumulative sum of elements starting from 0¶

In [ ]:

```
A
```

In [ ]:

```
A.cumsum()
```

#### Cumulative product of elements starting from 1¶

In [ ]:

```
A.cumprod()
```