Зміст курсу
Learning Statistics with Python
2. Mean, Median and Mode with Python
4. Covariance vs Correlation
Learning Statistics with Python
Calculate Variance with Python
Calculating Variance with NumPy
In NumPy, you need to input the sequence of values (in our case, the column of the dataset) into the np.var()
function, like this: np.var(df['work_year'])
.
Calculating Variance with pandas
In pandas, you should use the .var()
method on the sequence of values (in our case, the column of the dataset), like this: df['work_year'].var()
.
In both cases, the results are almost the same. The differences are due to different denominators: N in NumPy, and N-1 in pandas. Check it now!
Все було зрозуміло?
Зміст курсу
Learning Statistics with Python
2. Mean, Median and Mode with Python
4. Covariance vs Correlation
Learning Statistics with Python
Calculate Variance with Python
Calculating Variance with NumPy
In NumPy, you need to input the sequence of values (in our case, the column of the dataset) into the np.var()
function, like this: np.var(df['work_year'])
.
Calculating Variance with pandas
In pandas, you should use the .var()
method on the sequence of values (in our case, the column of the dataset), like this: df['work_year'].var()
.
In both cases, the results are almost the same. The differences are due to different denominators: N in NumPy, and N-1 in pandas. Check it now!
Все було зрозуміло?