Seksjon 1. Kapittel 4
single
Challenge: Cleaning a Real-World Dataset
Sveip for å vise menyen
Oppgave
Sveip for å begynne å kode
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
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 4
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår