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

single

Challenge: Cleaning a Real-World Dataset

Veeg om het menu te tonen

Taak

Veeg om te beginnen met coderen

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.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 4
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

some-alt