title: when to use numpy vs statistics modules
body: <p>While working on some statistical analysis tools, I discovered there are at least 3 Python methods to calculate mean and standard deviation (not counting the "roll your own" techniques):</p>
  
  <ul>
  <li><code>np.mean()</code>, <code>np.std()</code> (with ddof=0 or 1)</li>
  <li><code>statistics.mean()</code>, <code>statistics.pstdev()</code> (and/or <code>statistics.stdev</code>)  </li>
  <li><code>scipy.statistics</code> package</li>
  </ul>
  
  <p>That has me scratching my head. <em>There should be one obvious way to do it, right?</em> :-) I've found some older SO posts. One compares the performance advantages of <code>np.mean()</code> vs <code>statistics.mean()</code>. It also highlights differences in the sum operator. That post is here:
  <a href="https://stackoverflow.com/questions/37533666">why-is-statistics-mean-so-slow</a>  </p>
  
  <p>I am working with <code>numpy</code> array data, and my values fall in a small range (-1.0 to 1.0, or 0.0 to 10.0), so the <code>numpy</code> functions seem the obvious answer for my application. They have a good balance of speed, accuracy, and ease of implementation for the data I will be processing.   </p>
  
  <p>It appears the <code>statistics</code> module is primarily for those that have data in lists (or other forms), or for widely varying ranges <code>[1e+5, 1.0, 1e-5]</code>. Is that still a fair statement? Are there any <code>numpy</code> enhancements that address the differences in the sum operator? Do recent developments bring any other advantages?</p>
  
  <p>Numerical algorithms generally have positive and negative aspects: some are faster, or more accurate, or require a smaller memory footprint. When faced with a choice of 3-4 ways to do a calculation, a developer's responsibility is to select the "best" method for his/her application. Generally this is a balancing act between competing priorities and resources. </p>
  
  <p>My intent is to solicit replies from programmers experienced in statistical analysis to provide insights into the strengths and weaknesses of the methods above (or other/better methods). [<em>I'm not interested in speculation or opinions without supporting facts.</em>] I will make my own decision based on my design requirements.</p>