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
Welcome! In this video, I will provide my solution to the second challenge.
Challenge 2 solution
billboard_all = pd.concat([billboard, billboard19])
spotify_all = pd.concat([spotify, spotify19])
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
So how'd you do?
0:00
Allow me show you how to combine
all of my Billboard chart data and
0:02
all of my Spotify chart data.
0:05
We have two data frames
containing Billboard data.
0:07
billboard contains data from 2017 and
2018,
0:10
billboard19 contains 2019 data.
0:15
We wanna concatenate these datasets into
a new data frame called billboard_all.
0:19
The required argument is a Python
list containing the data frames.
0:26
We don't need any optional
arguments in this case.
0:31
So we type billboard_all
0:34
= pd.concat([billboard,
0:39
underscore billboard19.]).
0:46
Let's do the same with
the two Spotify dataframes.
0:58
Spotify_all = pd.concat,
1:03
([spotify, spotify19]).
1:10
Let's do a quick confidence check.
1:22
Billboard.shape, billboard19.shape.
1:27
Some quick math, billboard_all
should have roughly 12,800 rows.
1:40
Billboard_all.shape.
1:51
And they all have 7 columns, great.
1:55
I'll do the same for
Spotify, spotify.shape,
1:59
spotify19.shape.
2:10
Let's see, 20 and 7, let's call it 54,
2:17
spotify_all should have around
26,100 rows and 5 columns.
2:23
spotify_all.shape.
2:31
Now we have one large data frame with
30 months of Billboard chart data and
2:36
another large data frame with
30 months of Spotify chart data.
2:41
In the next video, we'll create our
final dataset that is merged and
2:47
concatenated from smaller datasets,
all using the pandas tool.
2:51
Can't wait.
2:55
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