Data engineering practice

Learn PySpark: tutorials, an online compiler and practice problems

Learn Apache Spark with Python, run PySpark in your browser, and practise with auto-graded PySpark, SQL and Python exercises. Follow a learning path or build a data engineering project.

Sum sales by regionGroup three rows and compare the totals.
from pyspark.sql import SparkSession

spark = SparkSession.builder.getOrCreate()
sales = spark.createDataFrame(
    [("East", 120), ("East", 120), ("West", 180)],
    ["region", "amount"],
)
(sales.groupBy("region")
      .sum("amount")
      .orderBy("region")
      .show())
Expected output
regionsum(amount)
East240
West180

Today's challenge

Loading today’s challenge…

Learning, practice and career tools

Learn PySpark step by step

PySpark is the Python API for Apache Spark, the engine data teams use for data too large for one machine. You write DataFrame code such as select, filter, groupBy and join, and Spark runs it in parallel across a cluster. Follow these topics in order, run every example in your browser, then test yourself on a problem.

See the full PySpark course
  1. Beginner tutorial: your first PySpark program
  2. Read CSV files into a DataFrame
  3. Filter rows
  4. groupBy and aggregations
  5. Joins
  6. Window functions
  7. Remove duplicates
  8. repartition vs coalesce

PySpark questions

What is PySpark?

PySpark is the Python API for Apache Spark. You write DataFrame code in Python, and Spark runs it in parallel across a cluster, so the same code works on a few rows or on billions.

Do I need to install Spark to practise?

No. The PySpark compiler on this site runs your code in the browser on sample datasets, so you can run examples without setting up Spark locally.

Is PySpark.in free?

The tutorials, the compiler and most practice problems are free. A one-time Premium Pass unlocks premium challenge access. Certification practice has its own free and paid options.

How do I prepare for a PySpark interview?

Learn the DataFrame basics first, then practise joins, aggregations and window functions on graded problems, and review the most asked interview questions with their answers.