Currently I am using this statement to find all columns in a dataframe that has no missing values, it works fine. but I’m wondering if there is more concise way (albeit, efficient way) to do the same thing?
df.columns[ np.sum(df.isnull()) == 0 ]
>Solution :
You can use this:
df.isna().any() # returns all columns either True (column names that has MISSING values) False (column names has NO MISSING values)
df.columns[df.isna().any()] # returns only the column names with MISSING values
df.columns[~df.isna().any()] # tilda negates the condition # returns the columns with NO MISSING values
df.columns[~df.isna().any()].tolist() # .tolist() converts the result to a list, if you wish.