Python function to get the t-statistic

Have you tried scipy?

You will need to installl the scipy library…more about installing it here: http://www.scipy.org/install.html

Once installed, you can replicate the Excel functionality like such:

from scipy import stats
#Studnt, n=999, p<0.05, 2-tail
#equivalent to Excel TINV(0.05,999)
print stats.t.ppf(1-0.025, 999)

#Studnt, n=999, p<0.05%, Single tail
#equivalent to Excel TINV(2*0.05,999)
print stats.t.ppf(1-0.05, 999)

You can also read about installing the library here: how to install scipy for python?

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)