Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Handle NULL Values

PySpark data engineering interview problem. Difficulty: beginner. Pattern: Missing Data. About 12 minutes. Free to practice.

Fill null emails, then drop rows with null phone. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

From df, fill NULL email with unknown@example.com, then drop rows where phone is NULL. Select user_id, email, phone. Order by user_id. Assign result.

Constraints

  • Fill email before dropna on phone.
  • Do not invent phones.

Examples

Input: user_id | email | phone Output: user_id | email | phone 1 | a@x.com | 111 2 | unknown@example.com | 222 5 | e@x.com | 555 Rows 3 and 4 lose phone and are dropped; row 2 keeps the filled email.

Topics: lakebench, pyspark, fillna, dropna.

More PySpark interview questions · All interview problems · Learn data engineering

beginner

Handle NULL Values

Interview-style drill: Fill null emails, then drop rows with null phone.

From `df`, fill NULL `email` with `unknown@example.com`, then drop rows where `phone` is NULL. Select `user_id`, `email`, `phone`. Order by `user_id`. Assign `result`.