title: Pandas create a mask based on multiple thresholds
body: <h4>Problem:</h4>
  <p>Lets say there is a Pandas Dataframe:</p>
  <pre class="lang-py prettyprint-override"><code>d = {'A': [0.1, 0.4, 0.2, 0.2],
       'B': [0.7, 0.3, 0.2, 0.9],
       'Z': [0.5, 0.3, 0.4, 0.6],
       'sth': ['abc', 'something', 'unimportant', 'x']}
  df = pd.DataFrame(data = d)
  df
  </code></pre>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: right;"></th>
  <th style="text-align: center;">A</th>
  <th style="text-align: center;">B</th>
  <th style="text-align: center;">Z</th>
  <th style="text-align: center;">sth</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: right;">0</td>
  <td style="text-align: center;">0.1</td>
  <td style="text-align: center;">0.7</td>
  <td style="text-align: center;">0.5</td>
  <td style="text-align: center;">&quot;abc&quot;</td>
  </tr>
  <tr>
  <td style="text-align: right;">1</td>
  <td style="text-align: center;">0.4</td>
  <td style="text-align: center;">0.3</td>
  <td style="text-align: center;">0.3</td>
  <td style="text-align: center;">&quot;something&quot;</td>
  </tr>
  <tr>
  <td style="text-align: right;">2</td>
  <td style="text-align: center;">0.2</td>
  <td style="text-align: center;">0.2</td>
  <td style="text-align: center;">0.4</td>
  <td style="text-align: center;">&quot;unimportant&quot;</td>
  </tr>
  <tr>
  <td style="text-align: right;">3</td>
  <td style="text-align: center;">0.2</td>
  <td style="text-align: center;">0.9</td>
  <td style="text-align: center;">0.6</td>
  <td style="text-align: center;">&quot;x&quot;</td>
  </tr>
  </tbody>
  </table>
  </div>
  <pre><code>thresholds = {'A': 0.5, 'B':0.8, 'Z': 0.3}
  </code></pre>
  <p><strong>I want to find a mask that will have <code>True</code> for <em>each row</em>, where highest value of this row is lower than threshold defined for this class.</strong></p>
  <p>For the given example, correct mask would be:</p>
  <pre><code>[ True, True, False, False]
  </code></pre>
  <h4>Explanation:</h4>
  <ol start="0">
  <li>Row <code>0</code>. First find the highest value in this row <code>max([0.1,0.7,0.5]) = 0.7</code>. Note that <code>0.7</code> was in column <code>B</code>. Compare this value with the threshold (0.8) for column <code>B</code>. <code>0.8 &gt; 0.7</code>, so result is True.</li>
  <li>Row <code>1</code> has highest value at column <code>A</code> cause <code>max([0.4,0.3,0.3]) = 0.4</code>, and threshold for class <code>A</code> is 0.5, hence <code>True</code></li>
  <li>Row <code>2</code> has highest value at column <code>Z</code> cause <code>max([0.2,0.2,0.4]) = 0.4</code>, and threshold for class <code>Z</code> is 0.3, hence <code>False</code></li>
  <li>Row <code>3</code> has highest value at column <code>B</code> cause <code>max([0.2,0.9,0.6]) = 0.9</code>, and threshold for class <code>B</code> is 0.8. Cause <code>0.8 &lt; 0.9</code> this row is <code>False</code></li>
  </ol>