question 427 pandas Transformations · medium
Tidy a customer export
Write tidy_customers(customers): return a new DataFrame where email is stripped and lower-cased, city is stripped and title-cased, state is stripped and upper-cased, and only the last row of each customer_id remains (later rows are newer). Keep the remaining rows in their original order. The caller's DataFrame must not change.
Function
tidy_customers(customers)customersa DataFrame with
customer_id, email, city, stateReturnsa new DataFrame with the same columns