Practice / strings dates nulls

Tidy the Names

easy

The Daily Grind's loyalty export has names typed by hand — stray spaces, random capitalisation. Tidy them for a mailing label.

people

Your task: return all columns plus clean_name, which is name trimmed of surrounding whitespace and uppercased.

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

peopleinput DataFrame

Schema
columntype
idlong
namestring
Sample rows
idname
1 ada
2Ben
3 cara
Expected output shape
idnameclean_name· 3 rows
Hint

Nest the two string functions: F.upper(F.trim(F.col("name"))). trim strips the outer whitespace; upper uppercases what's left. Add it as clean_name.

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.