title: Confidence Interval for t-test (difference between means) in Python
body: <p>I am looking for a quick way to get the t-test confidence interval in Python for the difference between means. Similar to this in R:</p>
  
  <pre><code>X1 &lt;- rnorm(n = 10, mean = 50, sd = 10)
  X2 &lt;- rnorm(n = 200, mean = 35, sd = 14)
  # the scenario is similar to my data
  
  t_res &lt;- t.test(X1, X2, alternative = 'two.sided', var.equal = FALSE)    
  t_res
  </code></pre>
  
  <p>Out:</p>
  
  <pre><code>    Welch Two Sample t-test
  
  data:  X1 and X2
  t = 1.6585, df = 10.036, p-value = 0.1281
  alternative hypothesis: true difference in means is not equal to 0
  95 percent confidence interval:
   -2.539749 17.355816
  sample estimates:
  mean of x mean of y 
   43.20514  35.79711 
  </code></pre>
  
  <p>Next:</p>
  
  <pre><code>&gt;&gt; print(c(t_res$conf.int[1], t_res$conf.int[2]))
  [1] -2.539749 17.355816
  </code></pre>
  
  <p>I am not really finding anything similar in either statsmodels or scipy, which is strange, considering the importance of significance intervals in hypothesis testing (and how much criticism the practice of reporting only the p-values recently got).</p>