I have dataframe like below.
Input
df A B C 1 2 1 NaN 4 2 3 NaN NaN NaN NaN NaN 4 2 NaN NaN NaN NaN Output
A B C 1 2 1 NaN 4 2 3 NaN NaN 4 2 NaN How can this be done in python
you can use:
df.dropna(how='all') you can look into this thread also: How to drop rows of Pandas DataFrame whose value in a certain column is NaN
You can select the df which is not NaN rather than dropping it:
df = df[~((df['A'].isna()) & (df['B'].isna()) & (df['C'].isna()))] This gives a bit more capability if you want to filter your df by certain values of each column.
A B C 1 2 1 NaN 4 2 3 NaN NaN 4 2 NaN You can use df.dropna?? to get the information about the dropna functionality.