Hey so the title might be hard to understand so basically here's a small sample of my DataFrame.
A B C D E F G H J K action
0 22 noise
1 68 junk
2 93 junk
3 80 junk
4 57 noise
The actions column only has two values (noise and junk). For instance in the first initial row column 'F' has a value of 22 and it's action is noise, and I want to count how many times 'F' has a non-null value when action is 'noise' and 'F' when action is 'junk'. Of course I want to count this for all the other single letter columns also. So I want to have a dictionary that likely looks like this where the inner dictionary has counts per action.
{'F': {'noise': 1, 'junk': 0},
'G': {'noise': 0, 'junk': 1},
'E': {'noise': 0, 'junk': 1},
'C': {'noise': 0, 'junk': 1},
'J': {'noise': 1, 'junk': 0}
}
I've tried going through with df.iterrows() and df.notnull() but I can't seem to get the logic right.
edit - Updated the expected output.