I have the following data frame:
df = pd.DataFrame({ 'Group' : [1,1,1,2,2,2,2],
'Type' : ["High","Medium","Low","High","Medium","Low","Low"],
'set_0' :["a","a","a","a","a","a","a"],
'set_1' :["b","b","b","c","c","c","d"],
'set_2' :["e","e","e","NULL","NULL","f","f"],
'set_3' :["g","g","NULL","NULL","NULL","NULL","NULL"],
'set_4' :["NULL","NULL","NULL","NULL","NULL","NULL","NULL"],
'set_5' :["NULL","NULL","NULL","NULL","NULL","NULL","NULL"],
'set_6' :["h","h","NULL","NULL","NULL","NULL","NULL"]
})
I want to drop some of "set_" columns. If a "set_" related column has all "NULL" values I don't want the code to keep them. I only want to keep set_ columns where it contains at least one non-"NULL" value.
How can I handle this without hardcoding it?