Challenge 2 - Update Users

We at CashBox would like you to update the user with email address [email protected] to have the last name "Deal".

There is a misspelling of a user whose username is jeffrey. It should only be one f, jefrey.

There are a couple ways to make this change happen, let's see what you can figure out!

After you've completed the TODO's click the Run Tests button

Need a little extra help? Check out the Treehouse Forum.

In [1]:
# Setup
import os
import pandas as pd

from tests.helpers import check

pd.options.display.max_rows = 10
users = pd.read_csv(os.path.join('data', 'users.csv'), index_col=0)
# Pop out a quick sanity check
len(users)
Out[1]:
475
In [2]:
## CHALLENGE - Update users ##

# TODO: Update [email protected] to have the last name of "Deal"

# TODO: Update the username jeffrey to jefrey (only one f)

# Return the whole data frame
users
Out[2]:
first_name last_name email email_verified signup_date referral_count balance
aaron Aaron Davis [email protected] True 2018-08-31 6 18.14
acook Anthony Cook [email protected] True 2018-05-12 2 55.45
adam.saunders Adam Saunders [email protected] False 2018-05-29 3 72.12
adrian Adrian Fang [email protected] True 2018-04-28 3 30.01
adrian.blair Adrian Blair [email protected] True 2018-06-16 7 25.85
... ... ... ... ... ... ... ...
wilson Robert Wilson [email protected] False 2018-05-16 5 59.75
wking Wanda King [email protected] True 2018-06-01 2 67.08
wright3590 Jacqueline Wright [email protected] True 2018-02-08 6 18.48
young Jessica Young [email protected] True 2018-07-17 4 75.39
zachary.neal Zachary Neal [email protected] True 2018-07-26 1 39.90

475 rows × 7 columns

In [3]:
check(__name__, 'Update users')
FF
======================================================================
FAIL: test_jeffrey_with_one_f (tests.helpers.TestUpdateUsers)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/craig/Code/scripting/intro-to-pandas/tests/test_cells.py", line 56, in test_jeffrey_with_one_f
    'Did you rename the username jeffrey to jefrey?'
AssertionError: False is not true : Did you rename the username jeffrey to jefrey?

======================================================================
FAIL: test_kim_deal (tests.helpers.TestUpdateUsers)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/craig/Code/scripting/intro-to-pandas/tests/test_cells.py", line 50, in test_kim_deal
    'Are you sure you updated the last name of [email protected] to "Deal"?'
AssertionError: nan != 'Deal' : Are you sure you updated the last name of [email protected] to "Deal"?

----------------------------------------------------------------------
Ran 2 tests in 0.003s

FAILED (failures=2)