Course · Distributed processing
PySpark for Data Engineers
Free PySpark course for Data Engineers: DataFrames, joins, window functions, partitions, shuffles and skew, with runnable code and interview questions.
- Lessons
- 12
- Interview questions
- 8
- Projects & case studies
- 2
- Reading time
- ~5 h
Your progress
Saved in this browser onlyCourse structure
- 1 lessonStart hereThe complete overview of the course in one read.
- 4 lessonsBeginnerCore concepts you will use every day.
- 6 lessonsIntermediatePatterns used in production pipelines.
- 1 lessonInterview preparationThe top interview questions, with answers.
Practise
- InterviewPySpark interview questionsThe full list with difficulty, type and a box to tick off each one.
- Cheat sheetPySpark Cheat SheetA quick PySpark reference: reading and writing data, column expressions, joins, aggregations, window functions and the settings that matter for performance.
- InterviewAll interview questionsEvery question across all topics in one filterable list.
Practice
88 problems in 5 topics, from basic to advanced. 2 have a full DataDank answer; 86 more are free problems on Spark Playground and StrataScratch that open on the platform. 0 of 88 done.
Spark Playground: free PySpark problems0/15
- Load and Transform Data (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Handling Null Values (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Total Purchases by Customer (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Clean Support Ticket Tags (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Streaming Device Split (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Last Visit Checkouts (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Workout Span (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Top Support Agents (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Top Delivery Cities (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Monthly Hotel Ratings (opens Spark Playground in a new tab)EasySpark Playground (opens in a new tab)
- Running Payroll (opens Spark Playground in a new tab)MediumSpark Playground (opens in a new tab)
- Food and Beverage Sales (opens Spark Playground in a new tab)MediumSpark Playground (opens in a new tab)
- Word Count Program in PySpark (opens Spark Playground in a new tab)MediumSpark Playground (opens in a new tab)
- Parse Product Attributes JSON (opens Spark Playground in a new tab)MediumSpark Playground (opens in a new tab)
- Department Budget Utilization (opens Spark Playground in a new tab)HardSpark Playground (opens in a new tab)
StrataScratch: easy (solve in PySpark)0/30
- Find all posts which were reacted to with a heart (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Finding Updated Records (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Total Cost Of Orders (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Workers With The Highest Salaries (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Average Salaries (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Completion Rate by Title (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Calculate Samantha's and Lisa's total sales revenue (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Wine varieties tasted by 'Roger Voss' (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Hour Of Highest Gas Expense (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Find all Lyft rides which happened on rainy days before noon (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Lyft Driver Wages (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Artist Appearance Count (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Top Ranked Songs (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Olympics Events List By Age (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Find all athletes who were older than 40 years when they won either Bronze or Silver medals (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Order Details (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Departments With 5 Employees (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- April Admin Employees (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- First Names With Six Letters Ending in 'h' (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Find drafts which contains the word 'optimism' (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Number of violations (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Inspection For Glassell Coffee Shop (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Churro Activity Date (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Most Profitable Financial Company (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- MacBookPro User Event Count (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Contact Information Completeness (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Users Missing Phone Numbers (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- High Earners in Support Departments (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Number of Shipments Per Month (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
- Unique Users Per Client Per Month (opens StrataScratch in a new tab)EasyStrataScratch (opens in a new tab)
StrataScratch: medium (solve in PySpark)0/36
- Users By Average Session Time (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Acceptance Rate By Date (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Finding User Purchases (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Risky Projects (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Busiest Restaurants in June 2025 (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Thumbs-Up Rate by Model Version (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- AI Feature Adoption Funnel (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Finding Purchases (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Ranking Most Active Guests (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Number Of Units Per Nationality (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Find the number of inspections for each risk category by inspection type (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Find the percentage of shippable orders (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Meta/Facebook Matching Users Pairs (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Matching Similar Hosts and Guests (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Income By Title and Gender (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Top Cool Votes (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Reviews of Categories (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Top Businesses With Most Reviews (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Find all possible varieties which occur in either of the winemag datasets (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Highest Target Under Manager (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Highest Salary In Department (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Employee and Manager Salaries (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Second Highest Salary (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Titanic Survivors and Non-Survivors (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Duplicate HR Department Employees (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Employees With the Same Salary (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Count Occurrences Of Words In Drafts (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Make the friends network symmetric (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Processed Ticket Rate By Type (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Top 10 Songs 2010 (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Customers with Large Orders (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Department Workforce Analysis (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Salary Less Than Twice The Average (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Flags per Video (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Maximum of Two Numbers (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
- Share of Active Users (opens StrataScratch in a new tab)MediumStrataScratch (opens in a new tab)
StrataScratch: hard (solve in PySpark)0/5
- Consecutive Days (opens StrataScratch in a new tab)HardStrataScratch (opens in a new tab)
- Best Selling Item (opens StrataScratch in a new tab)HardStrataScratch (opens in a new tab)
- Rank Variance Per Country (opens StrataScratch in a new tab)HardStrataScratch (opens in a new tab)
- Monthly Percentage Difference (opens StrataScratch in a new tab)HardStrataScratch (opens in a new tab)
- Counting Instances in Text (opens StrataScratch in a new tab)HardStrataScratch (opens in a new tab)
Worked answers (DataDank only)0/2
- When should you avoid Python UDFs in PySpark?MediumDataDank only
- When would you use a broadcast join in Spark?MediumDataDank only
Ticks are saved in this browser only and match the ticks on the interview pages.
Lessons
Work through the lessons in order. Completed lessons show a tick; lessons you have opened are outlined.
Start here
The complete overview of the course in one read.
Beginner
Core concepts you will use every day.
- PySpark DataFrames, Columns and SchemasPySpark DataFrames and schemas: explicit StructType schemas, select, withColumn and filter, null handling, and safe type casting under Spark 4 ANSI mode.
- PySpark Transformations vs ActionsUnderstand lazy evaluation in PySpark: transformations build a plan, actions run it, and narrow versus wide transformations decide where Spark shuffles data.
- PySpark Aggregations, Pivot and Temporary ViewsPySpark aggregations: groupBy and agg, rollup and cube subtotals, pivot and unpivot, and sharing DataFrames with SQL through temporary views.
- Reading and Writing Data in PySpark: Parquet, CSV, JSON, ORC, Avro and JDBCRead and write Parquet, CSV, JSON, ORC and Avro in PySpark, capture corrupt records, load JDBC tables in parallel and use partition discovery to prune folders.
Intermediate
Patterns used in production pipelines.
- PySpark Joins and Join StrategyWrite correct PySpark joins, then control how Spark executes them: broadcast hash, sort-merge and shuffle hash joins, hints, AQE, bucketing and bucketed joins.
- PySpark Window Functions: Ranking, Lag and Running TotalsPySpark window functions for top-N per group, deduplication, lag and lead, running totals, gap filling and sessions, and avoiding single-partition windows.
- PySpark UDFs, pandas UDFs and the Pandas API on SparkWhen to write Python UDFs in PySpark, how Arrow and pandas UDFs reduce their cost, how applyInPandas and UDTFs work, and when the pandas API on Spark fits.
- Nested and Complex Types in PySpark: Structs, Arrays, Maps and explodeWork with nested JSON in PySpark: query structs, arrays and maps, use higher-order functions, flatten with explode and posexplode, and rebuild nested output.
- Writing Efficient Output: File Sizes, Small Files and Partitioned WritesPySpark write performance: repartition vs coalesce before a write, partitioned output, the small files problem, fewer shuffles and custom partitioners.
- PySpark vs pandas vs Polars: When to Use EachPySpark vs pandas vs Polars: execution models, memory limits, APIs, Arrow interchange, testing and cost, with one task run in all three and when to pick each.
Interview preparation
The top interview questions, with answers.
Projects and case studies
Apply what you learned and prepare material to discuss in interviews.
Projects
- IntermediateLarge-Scale Batch Processing PipelineProcess a large public dataset (several gigabytes or more) with PySpark into partitioned, query-ready tables, and document, with evidence from the Spark UI and query plans, how you found and fixed the main performance bottleneck.
- IntermediateS3 → PySpark → Snowflake Data PipelineRaw event files arrive in object storage every day. Clean, deduplicate and aggregate them with PySpark, write curated Parquet partitioned by date, and load curated tables into a cloud warehouse for analysts, so that any day can be reprocessed on demand without duplicates.
Resources
Cheat sheets
- Cheat sheetPySpark Cheat SheetA quick PySpark reference: reading and writing data, column expressions, joins, aggregations, window functions and the settings that matter for performance.
- Cheat sheetApache Spark Interview Cheat SheetThe Spark concepts interviewers ask about most, in one page: lazy evaluation, stages and shuffles, joins, partitions, skew, AQE, caching and Spark 4 defaults.
Related courses
- Apache SparkFree advanced Apache Spark course for data engineers: architecture, jobs and stages, shuffles and skew, caching, AQE, memory tuning and Structured Streaming.
- SQLFree SQL course for Data Engineers: joins, window functions, CTEs, deduplication, SCD queries and query plans, with runnable examples and interview questions.
- PythonFree Python course for Data Engineering: generators, CSV and JSON files, APIs, pandas, error handling and pytest, with runnable code and interview questions.
- Delta LakeFree Delta Lake course: ACID transactions, MERGE, schema evolution, time travel, OPTIMIZE and Z-ordering for the lakehouse, with code and interview questions.

