title: Pandas count number in one column based off a condition in a different column
body: <p>I need to count the number of times id occurs given the condition that enroll &gt; 0. This is what I have so far...Any thoughts on how to do this? Thanks!</p>
  <pre><code>raw_data = [['a', '0'], ['a', '0'], ['a', '1'], ['b', '0'], ['b', '0.5'], ['c', '0'], ['c', '0']]
  df = pd.DataFrame(raw_data, columns = ['id', 'enroll'])
  df
  </code></pre>
  <p><a href="https://i.stack.imgur.com/7NRjr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7NRjr.png" alt="enter image description here" /></a></p>
  <pre><code>def countidsperenroll():
      for i in df['id']:
          if (enroll&gt;0):
              return value.count()
          continue 
  </code></pre>
  <p>The result should be a table with:
  the values:</p>
  <pre><code>3
  2
  0
  </code></pre>
  <p>because there were 3 <code>'a'</code> ids and there was an <code>enroll</code>&gt; 0 with one of the '<code>a</code>' ids. And because there were 2 '<code>b</code>' ids and there was an <code>enroll</code> &gt; 0 with one of the '<code>b</code>' ids. No '<code>enroll</code>' for the '<code>c</code>' id, So that gets a 0.</p>