I think you could use scipy.stats.t and the interval method:
In [1]: from scipy.stats import t In [2]: t.interval(0.95, 10, loc=1, scale=2)
Of course, you can make your own function if you want. Let it look like Mathematica :
from scipy.stats import t def StudentTCI(loc, scale, df, alpha=0.95): return t.interval(alpha, df, loc, scale) print StudentTCI(1, 2, 10) print StudentTCI(1, 2, 10, 0.99)
Result:
(-3.4562777039298762, 5.4562777039298762) (-5.338545334351676, 7.338545334351676)
source share