Course Content

# Learning Statistics with Python

2. Mean, Median and Mode with Python

3. Variance and Standard Deviation

4. Covariance vs Correlation

Learning Statistics with Python

## Calculate Variance with Python

**Calculating Variance with NumPy**

In **NumPy** you need to put the sequence of values (in our case, the column of the dataset) into the function `np.var()`

like `np.var(df['work_year'])`

.

**Calculating Variance with pandas**

In **pandas** you need to apply function `.var()`

to the sequence of values (in our case the column of the dataset) like `df['work_year'].var()`

.

In two cases, the result is almost the same. The differences caused by different denumerators: N in NumPy, and N-1 in pandas. Check it now!

Everything was clear?

Section 3. Chapter 3