Categories
counter pandas python python-2.7

Pandas Counting Unique Rows

I have a pandas data frame similar to:

ColA ColB
1 1
1 1
1 1
1 2
1 2
2 1
3 2

I want an output that has the same function as Counter. I need to know how many time each row appears (with all of the columns being the same.

In this case the proper output would be:

ColA ColB Count
1 1 3
1 2 2
2 1 1
3 2 1

I have tried something of the sort:

df.groupby(['ColA','ColB']).ColA.count()

but this gives me some ugly output I am having trouble formatting