title: np.where nested conditions on dataframe
body: <p>I have a dataframe named histdf like the following. I want to add a new column name 'Side' with the following conditions :</p>
  <p>Calculate the price difference between the priceAsk and the priceBid.</p>
  <p>If the price is greater than the average of the PriceAsk + PriceBid + 10% of price difference : side should be ask</p>
  <p>if the average is less than than the average of the PriceAsk + PriceBid - 10% of price difference : side should be bid</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Price</th>
  <th>priceBid</th>
  <th>PriceAsk</th>
  <th>Side</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>0.95</td>
  <td>0.75</td>
  <td>1.25</td>
  <td>should be bid</td>
  </tr>
  <tr>
  <td>1.05</td>
  <td>0.75</td>
  <td>1.25</td>
  <td>should be ask</td>
  </tr>
  <tr>
  <td>0.96</td>
  <td>0.75</td>
  <td>1.25</td>
  <td>should be mid</td>
  </tr>
  <tr>
  <td>1.00</td>
  <td>0.75</td>
  <td>1.25</td>
  <td>should be mid</td>
  </tr>
  <tr>
  <td>1.04</td>
  <td>0.75</td>
  <td>1.25</td>
  <td>should be mid</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Here is my failed attemp. Can you please help me with the appropriate code?</p>
  <pre><code>histdf['Side'] = np.where(histdf['price'] &lt; (((histdf['priceBid'] + histdf['priceAsk']) // 2) - (0.1 * ((histdf['priceBid'] + histdf['priceAsk']) // 2))) , 'BID', \
                  np.where(histdf['price'] &gt; (((histdf['priceBid'] + histdf['priceAsk']) // 2) + (0.1 * ((histdf['priceBid'] + histdf['priceAsk']) // 2))) , 'ASK', 'MID'))`
  </code></pre>
  <p>Thanks in advance for your help.</p>