Skip to content

PySpark functions

38 in-depth lessons. One function per lesson: what it does, how it works step by step, the gotchas, and every example in PySpark with its SQL equivalent.

Bronze

Module 1: Read and select

Load a dataset, pick and compute columns, filter and sort rows.

Module 2: Clean and type

Fix types, strings, dates and nulls.

Module 3: Combine and summarise

Aggregate, remove duplicates and join tables, in DataFrames or in SQL.

Silver

Module 4: Window functions

Rank rows and compare each row with the one before or after it.

Module 5: Smarter aggregates

Return the value from the row with the max, and compute medians and percentiles at scale.

Module 6: Arrays and nested data

Explode arrays (with positions), collect and query them, and flatten JSON.

Module 7: Reshape and refine

Pivot tables, filter by another table, match nulls safely, and handle dates and text precisely.

Module 8: Beyond built-ins

Write a UDF only when you must, and test your transformations.

Gold

Module 9: Gold window patterns

Write value-based frames, forward fills, streaks and sessions.

Module 10: Gold reshaping patterns

Build subtotals in one pass, turn wide tables long, and combine tables whose schemas drift.