title: How can I get rid of this warning? (RuntimeWarning: invalid value encountered in double_scalars)
body: <h1>Solved it</h1>
  
  <p>Used <code>n = np.divide(number1, number2)</code></p>
  
  <p>And checked <code>if number2 &gt; 0</code> before dividing</p>
  
  <hr>
  
  <p>I have this code: </p>
  
  <pre><code>condition5 = round(((df['Close'][-1] - df['Low'][-1])/(df['High'][-1] - df['Low'][-1])),2) &lt; 0.25
  </code></pre>
  
  <p><strong>df</strong> is a Dataframe that looks like this:</p>
  
  <pre><code>                  High         Low        Open       Close      Volume   Adj Close
  Date                                                                              
  2019-11-20  266.079987  260.399994  265.540009  263.190002  26558600.0  263.190002
  2019-11-21  264.010010  261.179993  263.690002  262.010010  30348800.0  262.010010
  2019-11-22  263.179993  260.839996  262.589996  261.779999  16331300.0  261.779999
  2019-11-25  266.440002  262.519989  262.709991  266.369995  21005100.0  266.369995
  2019-11-26  267.160004  262.500000  266.940002  264.290009  26301900.0  264.290009
  </code></pre>
  
  <p>And the message I get is: </p>
  
  <pre><code>RuntimeWarning: invalid value encountered in double_scalars
    condition5 = round(((df['Close'][-1] - df['Low'][-1])/(df['High'][-1] - df['Low'][-1])),2) &lt; 0.25
  </code></pre>
  
  <p>I don't get it, I have used print() to see the values and there wasn't anything weird nor any warning message popped up.</p>
  
  <p>I have also checked 
  <a href="https://stackoverflow.com/questions/27784528/numpy-division-with-runtimewarning-invalid-value-encountered-in-double-scalars">This Question</a>
  and the response says you can not get rid of it.</p>
  
  <p>Other links in stackoverflow suggest its a division by zero which is not true because It's not possible to have High - Low = 0.</p>
  
  <p><strong><em>UPDATE:</em></strong> </p>
  
  <p><strong>print(df['High'][-1] - df['Low'][-1])</strong></p>
  
  <pre><code>4.660003662109375
  </code></pre>
  
  <p><strong>print(df.to_dict())</strong></p>
  
  <pre><code>{'High': {Timestamp('2019-11-22 00:00:00'): 263.17999267578125, Timestamp('2019-11-25 00:00:00'): 266.44000244140625, Timestamp('2019-11-26 00:00:00'): 267.1600036621094}, 'Low': {Timestamp('2019-11-22 00:00:00'): 260.
  8399963378906, Timestamp('2019-11-25 00:00:00'): 262.5199890136719, Timestamp('2019-11-26 00:00:00'): 262.5}, 'Open': {Timestamp('2019-11-22 00:00:00'): 262.5899963378906, Timestamp('2019-11-25 00:00:00'): 262.70999145
  50781, Timestamp('2019-11-26 00:00:00'): 266.94000244140625}, 'Close': {Timestamp('2019-11-22 00:00:00'): 261.7799987792969, Timestamp('2019-11-25 00:00:00'): 266.3699951171875, Timestamp('2019-11-26 00:00:00'): 264.29
  00085449219}, 'Volume': {Timestamp('2019-11-22 00:00:00'): 16331300, Timestamp('2019-11-25 00:00:00'): 21005100, Timestamp('2019-11-26 00:00:00'): 26301900}, 'Adj Close': {Timestamp('2019-11-22 00:00:00'): 261.77999877
  92969, Timestamp('2019-11-25 00:00:00'): 266.3699951171875, Timestamp('2019-11-26 00:00:00'): 264.2900085449219}}
  </code></pre>
  
  <p><strong>print(df.info())</strong></p>
  
  <pre><code>&lt;class 'pandas.core.frame.DataFrame'&gt;
  DatetimeIndex: 3 entries, 2019-11-22 to 2019-11-26
  Data columns (total 6 columns):
  High         3 non-null float64
  Low          3 non-null float64
  Open         3 non-null float64
  Close        3 non-null float64
  Volume       3 non-null int64
  Adj Close    3 non-null float64
  dtypes: float64(5), int64(1)
  memory usage: 168.0 bytes
  None
  </code></pre>