Get startedGet started for free

Handling missing data with fill and drop

Oh my… You have a lot of missing values in this dataset! Let's clean it up! With the loaded CSV file, drop rows with any null values, and show the results!

Remember, there's already a SparkSession called spark in your workspace!

This exercise is part of the course

Introduction to PySpark

View Course

Exercise instructions

  • Drop any rows with null values in the census_df DataFrame.
  • Show the resulting DataFrame.

Hands-on interactive exercise

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

# Drop rows with any nulls
census_cleaned = census_df.____

# Show the result
census_cleaned.____
Edit and Run Code