CYBER WEEK - EXTRA SAVINGS EVENT
TRY A FREE LESSON

Standard Deviation

Screen Link: https://app.dataquest.io/m/309/z-scores/2/number-of-standard-deviations

Your Code: distance=220000-houses['SalePrice'].mean() st_devs_away=distance/houses['SalePrice'].std(ddof=0) st_devs_away1=distance/houses['SalePrice'].std() st_devs_away==st_devs_away1

What I expected to happen: I expected that the result of the comparisons between two variables will be True as both have a little difference. One variable includes ‘ddof’ parameter which is set to 0. The other variable is written without defining ‘ddof’ parameter but the default ‘ddof’ is also set to 0.

What actually happened: But the comparison returned False because both variables produced results having slight difference.

Other details:

Hi @waqaskhan93, the problem in your reasoning is here:

The other variable is written without defining ‘ddof’ parameter but the default ‘ddof’ is also set to 0.

The default argument for the ddof parameter is 1, not 0. You can see the documentation for Series.std here: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.std.html

Let me know if this doesn’t clarify things for you.

1 Like

Thanks a lot Alex. It clarified the problem. Actually I didn’t bother to read the pandas documentation, my fault. I just googled it and found std for numpy on documentation page

[https://docs.scipy.org/doc/numpy/reference/generated/numpy.std.html]