Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Combining Data for Analysis!
You have completed Combining Data for Analysis!
Preview
Welcome back! In this video, we will create our final dataset by merging and concatenating our original datasets into one large DataFrame.
Create final dataset of Ariana Grande song data
ariana_final = pd.merge(ariana_bill_all, ariana_spot_all, how='left', on=['Name', 'Artists', 'BB.Week'])
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
Welcome back.
0:00
In this video, we will create
our final dataset by merging and
0:02
concatenating our original datasets
into one large data frame.
0:06
Let's look at our Ariana Grande
data to see how to do it.
0:11
We have one dataset with all
Ariana's billboard data,
0:15
ariana_bill_all.shape.
0:21
We have one dataset with all
of Ariana's Spotify data,
0:27
ariana_spot_all.shape.
0:33
So, let's merge these two combined
datasets into our final dataset,
0:38
which we'll name ariana_final.
0:43
We want to perform a left outer
join on the common columns name,
0:46
artists and BB that week.
0:51
Ariana_final
0:56
= pd.merge(ariana_bill_all,
1:00
ariana_spot_all, how =
1:08
'left', On=['Name',
1:15
'Artists', 'BB.Week'].)
1:25
This final data frame should have the same
number of rows as our left dataset.
1:36
Let's run shape on the final data frame.
1:41
Ariana_final.shape.
1:47
And let's see the first few rows.
1:54
Ariana_final.head ().
1:57
Great.
2:07
So my final challenge to you is
to combine the full Billboard and
2:08
Spotify datasets into one large dataset.
2:12
Call this final data
frame bill_spot_final.
2:16
If you've completed
the first two challenges,
2:22
you're already more than halfway there.
2:23
Try it.
2:26
I'll show you my solution
when you're done.
2:27
See you soon.
2:29
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