Sektion 1. Kapitel 4
single
Challenge: Cleaning a Real-World Dataset
Stryg for at vise menuen
Opgave
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:
- Count how many rows have null
Delayin the original dataset – store innull_delay_count; - Fill nulls in
DelayandLengthwith0– store the cleaned DataFrame incleaned_df; - Remove duplicate rows based on
Airline,Flight, andDayOfWeek– updatecleaned_df; - Add a
TimeOfDaycolumn:"morning"ifTime < 720, otherwise"afternoon"– updatecleaned_df; - Count the number of rows in
cleaned_df– store incleaned_count.
Print all results.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 4
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat