Drop rows of pandas dataframe that don't have finite values in certain variable(s)
问题 I cannot see what the built-in function is for the following simple but seemingly common/useful task: Drop rows which have no value for any of my key columns. def keepIfPopulated(adf,interestingVars): good=0 for vv in interestingVars: good+=adf[vv].notnull() return(adf[good>0]) If there was just one column of interest, I could choose to keep it, but most pandas functions take one or more labels as arguments, so this question is about how to check on one or more columns at once. 回答1: adf = adf