title: Thresholding of probabilities in a binary classification
body: <p>I am struggling to compute the class label in a simple binary classification problem, given by 2d-numpy array with probabilities for each class. </p>
  
  <p><strong>For example:</strong></p>
  
  <pre><code>prob_01 = 
  array([[ 0.49253953,  0.50746047],
         [ 0.01041495,  0.98958505],
         [ 0.76774408,  0.23225592],
         ..., 
         [ 0.79755047,  0.20244953],
         [ 0.27228677,  0.72771323],
         [ 0.26953926,  0.73046074]])
  </code></pre>
  
  <p>where the rows are instances and the columns contain probabilities of being in the class 0 and 1 respectively for each instance. For example, for a <code>threshold = 0.5</code>, one should get:</p>
  
  <pre><code>labels_01= 
  array([[ 1],
         [ 1],
         [ 0],
         ..., 
         [ 1],
         [ 0],
         [ 0]])
  </code></pre>
  
  <p>What is the simplest and pythonic way to produce the <code>labels_01</code> array?</p>