#!/usr/bin/env python # coding: utf-8 # # Optional Challenge - Verified Email List # # We want you to produce a new DataFrame that contains the only following columns: # * first_name # * last_name # * email # # Ensure that all first names are title cased. Do not include any records that have a missing last name, and make sure that their email is verified (**`email_verified`** should be set True). Sort by last name and then by first. # # Choose `Kernel > Restart & Run all` to run the tests properly. # # In[1]: # Setup import os import pandas as pd from utils import make_chaos from tests.helpers import check pd.options.display.max_rows = 10 users = pd.read_csv(os.path.join('data', 'users.csv'), index_col=0) # Pay no attention to the person behind the curtain make_chaos(users, 19, ['first_name'], lambda val: val.lower()) # In[2]: ## CHALLENGE - Verified email list ## # TODO: Narrow list to those that have email verified. # The only columns should be first, last and email email_list = users[:] # TODO: Remove any rows missing last names # TODO: Ensure that the first names are the proper case # Return the new sorted DataFrame..last name then first name ascending email_list # In[3]: check(__name__, 'Verified email list')