Premium problem152. Tidy Up Names

Easy Locked

people has columns person_id and name, entered inconsistently.

Clean name by stripping surrounding whitespace, collapsing any run of internal whitespace to a single space, and title-casing the result, so " ADA lovelace " becomes "Ada Lovelace". Return the original columns with the index unchanged.

Input

   person_id               name
0          1    ADA   lovelace 
1          2       grace hopper
2          3     Alan\tTuring  

Output

   person_id          name
0          1  Ada Lovelace
1          2  Grace Hopper
2          3   Alan Turing

Premium problem

This one's part of Premium. Unlock the full Pandas track plus every other premium problem on the site.

Implement solve(...)