title: scipy stats error in calculating standard normal in python
body: <p>I'm trying to figure out the probability under a normal distribution in for my data <code>df</code> in python.  I'm not experienced with python or programming.  The following user-defined function I scraped from this site works, the scipy function does not work...</p>
  
  <p>UDF:</p>
  
  <pre><code>def normal(x,mu,sigma):
      return ( 2.*np.pi*sigma**2. )**-.5 * np.exp( -.5 * (x-mu)**2. / sigma**2. )
  df["normprob"] = normal(df["return"],df["meanreturn"],df["sdreturn"])
  </code></pre>
  
  <p>This scipy function does not work:</p>
  
  <pre><code>df["normdistprob"] = scip.norm.sf(df["return"],df["meanreturn"],df["sdreturn"])
  </code></pre>
  
  <p>and it returns the following error</p>
  
  <pre><code>C:\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py:1815: RuntimeWarning: invalid value encountered in true_divide
    x = np.asarray((x - loc)/scale, dtype=dtyp)
  C:\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py:1816: RuntimeWarning: invalid value encountered in greater
    cond0 = self._argcheck(*args) &amp; (scale &gt; 0)
  C:\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py:879: RuntimeWarning: invalid value encountered in greater
    return (self.a &lt; x) &amp; (x &lt; self.b)
  C:\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py:879: RuntimeWarning: invalid value encountered in less
    return (self.a &lt; x) &amp; (x &lt; self.b)
  C:\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py:1817: RuntimeWarning: invalid value encountered in greater
    cond1 = self._open_support_mask(x) &amp; (scale &gt; 0)
  C:\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py:1818: RuntimeWarning: invalid value encountered in less_equal
    cond2 = cond0 &amp; (x &lt;= self.a)
  </code></pre>
  
  <p>Any advice is appreciated.  Also to note, the first 20 cells of </p>
  
  <pre><code>df["meanreturn"]
  </code></pre>
  
  <p>are NA, not sure if that's affecting it.</p>