title: Count rows, where only specific columns are True
body: <p>I have a boolean dataframe. Where each row is, let us say a "classroom", and each column header is a "student_id". The classroom is set as the index, and I simply want to know the following:</p>
  
  <ul>
  <li>For various groupings (of student_ids), how many times do they, and ONLY they share a classroom.</li>
  </ul>
  
  <p>The dataframe looks something like the following:</p>
  
  <pre><code>df =pd.DataFrame({'classroom_id':[1,2,3,4], 'student_1':[True,True,True,True], 'student_2':[True,True,False,False], 'student_3':[True,False,False,False], 'student_4':[False,False,False,True]})
  
  df = df.set_index('classroom_id')
  </code></pre>
  
  <p>I just don't quite know how to query what I want, which is to ask, for example:</p>
  
  <blockquote>
    <p>How many times is student_1 and student_2 the ONLY true values?</p>
  </blockquote>
  
  <p>or</p>
  
  <blockquote>
    <p>How many times is student_1 and student_2 the ONLY students in a classroom?</p>
  </blockquote>
  
  <p>expected result:</p>
  
  <pre><code>1 (classroom 2)
  </code></pre>
  
  <p>But, I don't want it to return:</p>
  
  <pre><code>2 (classroom 1 and classroom 2)
  </code></pre>
  
  <p>I just don't know the correct query to put in for pandas for this...
  Let me know if there are any questions, especially over things that I did not make clear enough.</p>