Yes, n-1
is the degrees of freedom in that example.
Given a t-value and a degrees of freedom, you can use the "survival function" sf
of scipy.stats.t
(aka the complementary CDF) to compute the one-sided p-value. The first argument is the T value, and the second is the degrees of freedom.
For example, the first entry of the table on this page says that for 1 degree of freedom, the critical T value for p=0.1 is 3.078. Here's how you can verify that with t.sf
:
In [7]: from scipy.stats import t
In [8]: t.sf(3.078, 1)
Out[8]: 0.09999038172554342 # Approximately 0.1, as expected.
For the two-sided p-value, just double the one-sided p-value.