New: Cookbooks and AI ExplanationsStep-by-Step recipes to solve problems connected to Roadmaps and Cheat Sheets. Need more details? Use AI buttons for structured and simple explanations with concrete examples throughout the whole platform.Take a look
Some customer names arrive in ALL CAPS, some have extra spaces, and the emails mix upper and lower case throughout the file.
What you'll have at the end
A function that turns a batch of messy name and email values into one consistent format
You need
A batch of customer records, each holding a raw name and a raw email as separate text fields, a list of dictionaries or rows already read from a CSV, plus a working Python setup to run a cleaning script against them.
Not covered
Confirming an email address is real and actually receives mail, splitting a name into first and last parts, and handling names in scripts with no letter case, like Chinese or Arabic, all stay out of scope here: this only makes Latin-script names and syntactically well-formed emails consistent.
Leans on
Profile a brand new CSV file before you trust a single row in it
if you haven't seen this file before, profile it first to find out how messy the name and email columns actually are before you write a cleaning function for them.
Keep a script running when one row in the file is bad
once you're flagging a broken email instead of raising on it, this is where you make the rest of a much bigger batch survive a row that's truly unusable.
Checked 25 Aug 2026
Part of the Python cookbook