title: How to count in dataframe groupby
body: <p>I have a dataframe which contains data about buyers and sellers. I wanted to groupby each pair to see how many times a seller and buyer have a transaction, this also sums all their transaction to work out the total spent in their transactions:</p>
  <pre><code>df2 = df.groupby(['ID of seller','ID of buyer', 'currency'])[&quot;Total spent&quot;].sum().reset_index(drop = False) 
  </code></pre>
  <p>this gives me:</p>
  <p>df2 =</p>
  <pre><code>ID of seller    ID of buyer    Currency   Total spent
  871             356            GBP        60
  473             784            GBP        40
  etc...     
  </code></pre>
  <p>I want to add another column which states how many times each pair has traded. So it would look like:</p>
  <pre><code>ID of seller    ID of buyer    Currency   Total spent  Num of transactions
  871             356            GBP        60           2
  etc...
  </code></pre>
  <p>from my understanding this would be done using .count() but i can't seem to work out where to fit it in.</p>