title: pandas - Counting occurrences of a value in a DataFrame per each unique value in another column
body: <p>Supposing that I have a DataFrame along the lines of:</p>
  
  <pre class="lang-py prettyprint-override"><code>    term      score
  0   this          0
  1   that          1
  2   the other     3
  3   something     2
  4   anything      1
  5   the other     2
  6   that          2
  7   this          0
  8   something     1
  </code></pre>
  
  <p>How would I go about counting up the instances in the <code>score</code> column by unique values in the <code>term</code> column? Producing a result like:</p>
  
  <pre class="lang-py prettyprint-override"><code>    term      score 0     score 1     score 2     score 3
  0   this            2           0           0           0
  1   that            0           1           1           0
  2   the other       0           0           1           1
  3   something       0           1           1           0
  4   anything        0           1           0           0
  </code></pre>
  
  <p>Related questions I've read here include <a href="https://stackoverflow.com/questions/20995196/python-pandas-counting-and-summing-specific-conditions">Python Pandas counting and summing specific conditions</a> and <a href="https://stackoverflow.com/questions/24810526/countif-in-pandas-python-over-multiple-columns-with-multiple-conditions">COUNTIF in pandas python over multiple columns with multiple conditions</a>, but neither seems to quite be what I'm looking to do. <code>pivot_table</code> as mentioned at <a href="https://stackoverflow.com/questions/37203156/finding-intersection-of-values-in-a-column-associated-with-unique-values-in-anot">this question</a> seems like it could be relevant but I'm impeded by lack of experience and the brevity of the pandas documentation. Thanks for any suggestions.</p>