Here is what I have done:
df = pd.DataFrame(data={'in':[2, 2, 3, 4], 'out':[2,2,4,4]}) in_out=df.groupby(['in','out']).size() I got results:
in out 2 2 2 3 4 1 4 4 1 dtype: int64 How do I turn the results into a dataframe with columns in, out and count?