BuildlyBuildly
DashboardExercisesProfileHelp
Data Science/Module 3: Importing & Handling Files/String Cleanup (Series)3/3
Exercise·7 min·10 XP

Strip Separators from a Column

Context. A phone column has numbers written with all kinds of separators — hyphens and spaces — and you need them as plain digit strings.

Your task. Write clean_phone_numbers(df) that returns the phone column as a Series with every hyphen (-) and space removed.

Example. "98-765 43210" → "9876543210".

Notes. Return a Series. Remove both hyphens and spaces. Values with no separators pass through unchanged.

Previous
Normalize Text Values
Next
Extract a Pattern