擅长:python、mysql、java
<p>您可以使用<a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.t.html" rel="nofollow noreferrer">^{<cd2>}</a>的<code>ppf</code>方法(即分位数函数):</p>
<pre><code>In [129]: from scipy.stats import t
In [130]: alpha = 0.025
In [131]: t.ppf(1 - alpha, df=9)
Out[131]: 2.2621571627409915
</code></pre>
<p><code>t.ppf()</code>最终调用<a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.stdtrit.html" rel="nofollow noreferrer">^{<cd4>}</a>,因此您也可以使用该函数并避免执行<code>t.ppf()</code>的轻微开销:</p>
^{pr2}$
<p>(如果您想知道函数是如何以名称<code>stdtrit</code>结尾的,那么它就是<strong>S</strong>tudent<strong>T</strong><strong>D</strong>是<strong>TR</strong>I</strong>关于<strong>T</strong>的反向。明白了,对吗?)在</p>