degrees_freedom = sample.size - 1
Here is what the above code is Doing:
1. We’re using the scipy.stats.ttest_ind function to calculate the T-test for the means of two independent samples of scores.
2. This function returns the T-statistic, and the p-value (see documentation here).
3. The T-statistic is a measure of how many standard errors there are between the two groups.
4. The larger the T-statistic, the more difference there is between groups.
5. The p-value is the probability that you would get the result you did (or more extreme) given that the groups are the same.
6. The smaller the p-value, the more evidence you have that the groups are different.