3

Refer to the code shown below:

import numpy as np
import pandas as pd
fir_salary = [10000,20000,15000,20000,15000,25000]
df=pd.DataFrame(fir_salary)

print(np.std(fir_salary))
print(df.std()) <-- Return different output

I have referred to the thread Different Standard Deviation in Pandas and Numpy which talks about the degree of freedom.

But I need help to understand what exactly is the degree of freedom. Does it have to do anything with sample and population standard deviation calculations?

  • 2
    Refer to link https://www.aboutdatablog.com/post/why-computing-standard-deviation-in-pandas-and-numpy-yields-different-results if this helps. – Tavish Aggarwal Sep 23 '22 at 04:27
  • There is also this question which has a good explanation and further links in one of the answers: [Different std in pandas vs numpy](https://stackoverflow.com/questions/24984178/different-std-in-pandas-vs-numpy) – Bill Sep 23 '22 at 04:44
  • They use different defaults for the degrees of freedom – mozway Sep 23 '22 at 04:55

0 Answers0