Practice / strings dates nulls

Fill the Blanks

easy

Waveform wants a clean signup table for reporting — no blank regions.

signups

Your task: return all columns, but replace any null region with the string "unknown". Every row must be kept.

Assign your answer DataFrame to result. Row order doesn't matter.

signupsinput DataFrame

Schema
columntype
user_idlong
regionstring
Sample rows
user_idregion
1EU
2null
3US
4null
Expected output shape
user_idregion· 4 rows
Hint

F.coalesce(F.col("region"), F.lit("unknown")) returns the first non-null of its arguments. Assign it back to region with withColumn, keeping all rows.

Lesson refresher

This problem builds on Strings, Dates & Nulls (~8 min). Pop it open in a new tab if you want a quick recap.

Loading editor…
Hit Run to execute your code and see the output here.