I have a df like this:
xx yy zz
A 6 5 2
B 4 4 5
B 5 6 7
C 6 6 6
C 7 7 7
Then I have a dictionary with some keys (which correspond to the index names of the df) and values (column names):
{'A':['xx'],'B':['yy','zz'],'C':['xx','zz']}
I would like to use the dictionary to check that those column names that do not appear in the dict values , are set to zero to generate this output:
xx yy zz
A 6 0 0
B 0 4 5
B 0 6 7
C 6 0 6
C 7 0 7
How could I use the dictionary to generate the desired output?