LoslegenKostenlos loslegen

Filtering by company

Using that same dataset from the last exercise, you realized that you only care about the jobs that are entry level ("EN") in Canada ("CA"). What does the salaries look like there? Remember, there's already a SparkSession called spark in your workspace!

Diese Übung ist Teil des Kurses

Introduction to PySpark

Kurs anzeigen

Anleitung zur Übung

  • Filter to subset the DataFrame to where company_location is "CA".
  • Calculate the average of the salary_in_usd column.
  • Show the result!

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Average salary for entry level in Canada
CA_jobs = ca_salaries_df.____(ca_salaries_df[____] == "CA").filter(ca_salaries_df['experience_level']
 == "EN").groupBy().____("salary_in_usd")

# Show the result
CA_jobs.____()
Code bearbeiten und ausführen