# How to compute the standard error of the mean with Pandas using Python

2 min

## What is the standard error of the mean?

The standard error usually gives you an idea of how close your sample is to the true population.

With the mean that would be how close your sample mean is to the true population mean.

### An example

E.g. You have a basket of apples, some are rotten. You can say that on average 1 out of 100 are rotten (so 1/100 = 0.01 or 1%).

The farmer that sold you the apples does have on average 1000 rotten apples out of 50000 in his stock. (so 1000/50000 = 0.02  or 2%).

We can assume that you were lucky when buying your basket of apples because on average you got more good apples than you should have got. (0.02  - 0.01 = 0.01 or 1% difference).

Now, if your friends also bought some apples, the standard error of the mean would be the variation in the number of rotten apples between you and your friends.

### The conclusion

All that to say that you cannot reliably conclude that you get 1% rotten apple on average and the standard error of the mean is here to tell you how far you are from reality.

Enough talking,

## Here is the code

Here you are! You now know how to compute the standard error of the mean with Pandas using Python.

# More on DataFrames

If you want to know more about DataFrame and Pandas. Check out the other articles I wrote on the topic, just here :