Get startedGet started for free

Removing missing values

Now that you know there are some missing values in your DataFrame, you have a few options to deal with them. One way is to remove them from the dataset completely. In this exercise, you'll remove missing values by removing all rows that contain missing values.

pandas has been imported as pd and avocados_2016 is available.

This exercise is part of the course

Data Manipulation with pandas

View Course

Exercise instructions

  • Remove the rows of avocados_2016 that contain missing values and store the remaining rows in avocados_complete.
  • Verify that all missing values have been removed from avocados_complete. Calculate each column that has NAs and print.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Remove rows with missing values
avocados_complete = ____

# Check if any columns contain missing values
print(____)
Edit and Run Code