Pandasdrill

Level 2: Cleaning Exercise 13 of 45 Pro

Tidy up text with strip and lower

A pandas exercise from Pandasdrill. Solve it with a Python editor in your browser running real pandas, and it is checked the moment you submit.

The task

The emails in `signups` have stray spaces and mixed case. Return the `email` column as a Series with spaces removed from both ends and every letter in lowercase.

What this exercise teaches

str.strip removes leading and trailing whitespace and str.lower lowercases every character. Chaining them cleans both problems in one expression, and the order does not matter here.

A hint if you get stuck

String methods live under .str on a Series, and you can chain them.

This exercise is part of Pro

Pro unlocks all 45 exercises, with worked solutions and progress saved to your account. The free exercises work without an account.

You create a free account first, so Pro is attached to it.

Monthly is charged today and then every month until you cancel, in one click from your account page. Lifetime is one payment with no renewals. Full refund within 14 days of paying.

Start with the free exercises

More exercises in Cleaning