I have the following dataframe in which I am trying to count the total number of the values of "MISSING" per column grouped by A, B and C but I am trying to keep it in the format below , I am not sure if I have to reshape the dataframe or use stack:
               A   B           C        D        E        F  
0     Miami Heat  FL  Basketball       21  MISSING  MISSING            
1     Miami Heat  FL  Basketball       17  MISSING  MISSING            
2     Miami Heat  FL  Basketball  MISSING       12       23             
3  Orlando Magic  FL  Basketball  MISSING        5  MISSING             
4  Orlando Magic  FL  Basketball       10  MISSING  MISSING             
5  Orlando Magic  FL  Basketball        5  MISSING  MISSING             
This is what I would like the result to be:
A        B   Column Name   Missing Count
Miami   Heat FL  D             1
Miami   Heat FL  E             2
Miami   Heat FL  F             2
Orlando Magic FL D             1
Orlando Magic FL E             2
Orlando Magic FL F             3
This code does not work:
df = finalDF.assign(Missing Count = finalDF.eq("MISSING").sum(axis=1))
.groupby(['A','B','C']) ['Missing Count'].count()
 
     
    