Frequency count based on 2 columns, turn output into data frame

  dataframe, jupyter-lab, pivot-table, python

I have data frame blue. blue contains 8 columns. I want to take the last two columns, rek and dak, and see how many times each combination of outputs appears there.

for example, when I use the code blue.pivot_table(index=['rek','dak'], aggfunc='size')

I get

      Ref_aa  Alt_aa
*       C          1
        E          1
        G          1
        L          3
        Q          1
Y       H         26
        N         14
        S         10
        X         66
        Y          6

When I use the code qw_altref = qw.to_frame() qw_altref

I get it in a data frame format. How can I change the data frame so it looks more like this?

rek   dak    count
a      g       21
a      f        7

the count column would be how many combinations of each rek and dak there would be

Source: Python Questions