I think this is a fairly basic question, but I can\'t seem to find the solution.
I have a pandas dataframe similar to the following:
import pandas as
This is an identical replacement for df.groupby(['A', 'B']).size().
df.groupby(['A', 'B']).size()
df.value_counts(['A', 'B']) A B z r 2 x p 2 y q 1 dtype: int64
df.value_counts(['A', 'B']).reset_index(name='c') A B c 0 z r 2 1 x p 2 2 y q 1