title: Duplicate rows in pandas DF
body: <p>I have a DF in Pandas, which looks like:</p>
  
  <pre><code>Letters Numbers
  A       1
  A       3
  A       2
  A       1
  B       1
  B       2
  B       3
  C       2
  C       2
  </code></pre>
  
  <p>I'm looking to count the number of similar rows and save the result in a third column. For example, the output I'm looking for:</p>
  
  <pre><code>Letters Numbers Events
  A       1       2
  A       2       1
  A       3       1
  B       1       1
  B       2       1
  B       3       1
  C       2       2
  </code></pre>
  
  <p>An example of what I'm looking to do is <a href="https://stackoverflow.com/questions/15453237/count-occurences-of-a-row-with-pandas-in-python">here</a>. The best idea I've come up with is to use <code>count_values()</code>, but I think this is just for one column. Another idea is to use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.duplicated.html" rel="nofollow noreferrer"><code>duplicated()</code></a>, anyway I don't want construct any <code>for</code>-loop. I'm pretty sure, that a Pythonic alternative to a for loop exists.</p>