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

single

Challenge: Cleaning a Real-World Dataset

Svep för att visa menyn

Uppgift

Svep för att börja koda

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.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 4
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

some-alt