I'm quite new to Python.
I've the below sample dataframe df.
Col1 Col2 Col3
0 0 1 1
1 1 1 0
2 0 1 1
3 1 0 1
4 0 0 1
If I use this code df.apply(pd.Series.value_counts, axis=0)
And I'm getting result as:
Col1 Col2 Col3
0 3 2 1
1 2 3 4
But, I want the result as below (like pivot):
Col_Name 0 1
0 Col1 3 2
1 Col2 2 3
2 Col3 1 4
Please suggest. Thanks in advance.