I have data frame like below
df = pd.DataFrame([['pqr', 'abc', 'pqr', 'NULL', 'NULL']],
columns=['col1', 'col2', 'col3', 'col4', 'col5'])
col1 col2 col3 col4 col5
0 pqr abc pqr NULL NULL
Desired output:
code count
pqr 2
abc 1
How can I do to get above in Python?
I have tried with groupby:
df.groupby(['col1', 'col2', 'col3', 'col4', 'col5']).count().reset_index()
I didn't get desired output.