How to remove rows with null values from a column?
Question:
I have small dataframe with null values in columns.
Movie
Duration
Avatar
178
Spectre
John Carter
132
Tangled
Titanic
195
I can remove rows with null values for one column at a time with this command –
df.drop(df[df['duration'].isnull()].index)
But, suppose I had a large dataframe with hundreds of columns with null row values, then removing null row values for one column at a time is not possible.
What should be my approach in such a case?
Answers:
I have small dataframe with null values in columns.
Movie | Duration |
---|---|
Avatar | 178 |
Spectre | |
John Carter | 132 |
Tangled | |
Titanic | 195 |
I can remove rows with null values for one column at a time with this command –
df.drop(df[df['duration'].isnull()].index)
But, suppose I had a large dataframe with hundreds of columns with null row values, then removing null row values for one column at a time is not possible.
What should be my approach in such a case?