Skip to content

Instantly share code, notes, and snippets.

@MariaLavrovskaya
Created October 13, 2019 12:15
Show Gist options
  • Save MariaLavrovskaya/a657f9bc8db84470f12ade2ac9d47554 to your computer and use it in GitHub Desktop.
Save MariaLavrovskaya/a657f9bc8db84470f12ade2ac9d47554 to your computer and use it in GitHub Desktop.
airbnb_10
from scipy import stats
## Compare with the critical t-value
#Degrees of freedom
df = 2*22326 - 2
print(df)
#p-value after comparison with the t
p = 1 - stats.t.cdf(t,df=df)
print("t = " + str(t))
print("p = " + str(2*p))
## Cross Checking with the internal scipy function
t2, p2 = stats.ttest_ind(entire_subset['minimum_nights'],private_room['minimum_nights'])
print("t = " + str(t2))
print("p = " + str(p2))
### If the p-value is less than 0.05, we reject the null hypothesis
###that there's no difference between the means and conclude that a
###significant difference does exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment