Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Tackle the data cleaning challenge using your knowledge so far.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
[SOUND] Hi again, Megan here.
0:08
In this practice session, you're going
to practice accessing and cleaning data.
0:11
I'm going to give you a set of
user information to clean and
0:16
store into a new data structure.
0:20
Let's take a look.
0:22
In data.py,
you have a variable data that is holding
0:25
a list that's filled
with dictionary items.
0:30
Each dictionary item has
a set of key value pairs and
0:35
all of the values you can see are strings.
0:39
So we have email, name,
date_joined, admin and id.
0:42
Let's look at our instructions in app.py.
0:48
First, you're going to split the full name
into two fields, first name and last name.
0:51
So if I bring us back to our data,
0:57
you can see the names come in like
Warren Bates or Edgar Howell.
1:00
So you will need to split that
into the first name and last name.
1:05
Number 2, convert the admin
field to a boolean value.
1:08
Again, let's pop back over.
1:15
And you can see our admin field
is a string but it's a boolean.
1:17
It's false, false, false.
1:22
So we need to convert that so that it's
an actual boolean and not a string.
1:23
Then we wanna convert
the id to an integer.
1:28
Again, it's also a string but
it should be an integer.
1:32
We have 36, 40, etc.
1:36
And the rest of the info,
we wanna keep the same.
1:40
So your email and your date_joined for
now are going to stay exactly the same.
1:44
So they should still be
these exact same strings.
1:49
You're going to complete
this inside of a function or
1:54
you can split it up into multiple
functions if you would like.
1:57
That's up to you.
2:00
Then I want you to make sure that the data
is saved into a new data structure.
2:02
And it should be something similar,
2:07
like a list of dictionaries just
like we have here in data.py.
2:10
Think you can tackle this?
2:14
Give it a go and
I'll see you in the next video
2:16
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up