Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Having the following Dataframe:
- First Second Third Fourth
- 0 NaN 2 NaN 0
- 1 3 4 NaN 1
- 2 NaN NaN NaN 5
- 3 4 1 2 3
- # by default dropna() removes rows with NaN in ANY of the colums
- df.dropna()
- First Second Third Fourth
- 3 4 1 2 3
- # Remove NaN only from an specific column
- df.dropna(subset=['Second'])
- First Second Third Fourth
- 0 NaN 2 NaN 0
- 1 3 4 NaN 1
- 3 4 1 2 3
Add Comment
Please, Sign In to add comment