Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Analyzing Sales Data with Spark SQL | Section
Data Processing with PySpark
Abschnitt 1. Kapitel 9
single

single

Challenge: Analyzing Sales Data with Spark SQL

Swipe um das Menü anzuzeigen

Aufgabe

Wischen, um mit dem Codieren zu beginnen

You are given a flights dataset as a list of rows. Load it into a DataFrame, register it as a temporary view, and answer the following using spark.sql(). Store results in the specified variables:

  1. Find the top 3 routes (unique AirportFrom + AirportTo pairs) by average Length – store as a list of tuples [(origin, destination, avg_length), ...] in top_routes_by_length;
  2. For each airline, find the flight with the longest Length using a window function with row_number() – store as a DataFrame in longest_flight_per_airline with columns Airline, Flight, Length;
  3. Count how many delayed flights (Delay == 1) per DayOfWeek – store as a list of tuples [(day_of_week, count), ...] sorted by DayOfWeek ascending in delays_by_dow.

Print all results.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 9
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

some-alt