Home›Library›AI & Data Science
Curated LibraryPySpark for Beginners: DataFrames, Spark SQL Functions and Data Transformations
A 54-lesson, hands-on walkthrough of PySpark's DataFrame API, running mostly in Azure Databricks notebooks. It covers reading and writing CSV, JSON and Parquet, defining schemas, and working with column types. It also covers filtering, joins, aggregation, pivoting, JSON, date and window functions, UDFs, RDD basics and Spark SQL temp views. It suits beginners who know some Python and SQL and want to do day-to-day data transformation work in PySpark.
- 54 lessons
- 10h 32m total
- AI & Data Science
- English
- Earns YodaCoins
Curated by YodaHut. These lessons are hosted on YouTube and produced by their original creators, who are not affiliated with YodaHut. You still earn YodaCoins, keep your streak and track progress here.
What You'll Learn
- Create DataFrames from hard-coded values and read or write CSV, JSON and Parquet files with PySpark
- Define schemas with StructType/StructField and work with ArrayType and MapType columns using explode, split and map functions
- Transform data with withColumn, select, filter, when/otherwise, sorting, deduplication, fillna and union/unionByName
- Combine and reshape data using inner, outer, semi, anti and self joins, groupBy with agg, pivot and unpivot
- Parse and generate JSON columns with from_json, to_json, json_tuple and get_json_object, and apply date and timestamp functions
- Query DataFrames with SQL through temp views, write UDFs, use window ranking functions, and partition output files with partitionBy
Prerequisites
- Basic Python (functions, lists, dictionaries)
- Familiarity with SQL concepts such as joins and group by is helpful
- Access to a Databricks or Synapse workspace, or a local Spark setup, to follow along
Course Curriculum
54 lessons · 10h 32m- 01What Is PySpark?10:13
- 02Create a DataFrame Manually with Hard-Coded Values26:38
- 03Read a CSV File into a DataFrame28:33
- 04Write a DataFrame to a CSV File28:05
- 05Read a JSON File into a DataFrame23:33
- 06Write a DataFrame to a JSON File13:54
- 07Read a Parquet File into a DataFrame12:40
- 08Write a DataFrame to a Parquet File14:11
- 09show(): Display DataFrame Contents as a Table9:12
- 10withColumn(): Add or Change Columns and Data Types15:42
- 11withColumnRenamed(): Rename Columns6:38
- 12StructType and StructField: Defining Schemas13:20
- 13ArrayType Columns14:53
- 14explode(), split(), array() and array_contains()18:03
- 15MapType Columns12:06
- 16map_keys(), map_values() and explode() with MapType7:39
- 17The Row Class11:40
- 18The Column Class16:15
- 19when() and otherwise()10:46
- 20alias(), asc(), desc(), cast() and like()11:43
- 21filter() and where()6:37
- 22distinct() and dropDuplicates()7:30
- 23orderBy() and sort()7:58
- 24union() and unionAll()8:59
- 25groupBy()7:30
- 26GroupBy agg(): Multiple Aggregations8:19
- 27unionByName()6:26
- 28select()7:20
- 29join(): Inner, Left, Right and Full Joins11:04
- 30join() Continued: Left Semi, Left Anti and Self Joins14:11
- 31pivot()7:29
- 32Unpivot a DataFrame with stack()9:15
- 33fill() and fillna()8:19
- 34sample()8:28
- 35collect()9:37
- 36DataFrame.transform()8:53
- 37pyspark.sql.functions.transform() on Array Columns10:00
- 38createOrReplaceTempView()8:01
- 39createOrReplaceGlobalTempView()10:13
- 40User-Defined Functions (UDFs)15:07
- 41Convert an RDD to a DataFrame7:50
- 42RDD map() Transformation11:14
- 43RDD flatMap() Transformation9:48
- 44partitionBy(): Partitioning Output Files14:21
- 45from_json(): JSON String to MapType11:41
- 46from_json(): JSON String to StructType7:56
- 47to_json()9:06
- 48json_tuple()7:50
- 49get_json_object()8:04
- 50Date Functions: current_date(), to_date(), date_format()11:17
- 51Date Functions: datediff(), months_between(), add_months(), date_add(), month(), year()10:56
- 52Timestamp Functions10:47
- 53Aggregate Functions: approx_count_distinct, avg, collect_list, collect_set, countDistinct, count10:16
- 54Window Ranking Functions: row_number(), rank(), dense_rank()13:26
About the Instructor
WafaStudies
YouTube creator
The lessons in this course were produced by WafaStudies and are published on YouTube. YodaHut selected and sequenced them into this course; we did not make them, and WafaStudies is not affiliated with YodaHut.
Visit the channel on YouTubeMore in the Library: AI & Data Science

Time Series Forecasting with Python: ETS, ARIMA, Machine Learning, Deep Learning and Prophet

Time Series Forecasting in Python: ARIMA, VAR, Prophet and LSTM

Time Series Analysis and Forecasting in Python: From Stationarity to ARIMA and SARIMA

ComfyUI Academy: Build Stable Diffusion Workflows from Scratch

ComfyUI for AI Image Generation: Stable Diffusion, Flux, LoRAs, Upscaling and Editing
