Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Cleaning a Real-World Dataset | Section
Data Processing with PySpark
Section 1. Chapter 4
single

single

Challenge: Cleaning a Real-World Dataset

Swipe to show menu

Task

Swipe to start coding

You are given a flights dataset as a list of rows. Load it into a DataFrame using createDataFrame and clean it using the techniques from the previous chapters. Store results in the specified variables:

  1. Count how many rows have null Delay in the original dataset – store in null_delay_count;
  2. Fill nulls in Delay and Length with 0 – store the cleaned DataFrame in cleaned_df;
  3. Remove duplicate rows based on Airline, Flight, and DayOfWeek – update cleaned_df;
  4. Add a TimeOfDay column: "morning" if Time < 720, otherwise "afternoon" – update cleaned_df;
  5. Count the number of rows in cleaned_df – store in cleaned_count.

Print all results.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 4
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt