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! In this video, I will provide my solution to the third challenge.
Challenge 3 solution
bill_spot_final = pd.merge(billboard_all, spotify_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
                      We're at the finish line.
                      0:00
                    
                    
                      Let me show you how I created my final
dataset with all the data we've loaded
                      0:01
                    
                    
                      into Pandas.
                      0:05
                    
                    
                      In the second challenge, you concatenated
the two Billboard datasets into one
                      0:07
                    
                    
                      combined Billboard data frame.
                      0:12
                    
                    
                      And you did the same with
the Spotify datasets.
                      0:15
                    
                    
                      So our final step would be to merge
the combined billboard data frame and
                      0:18
                    
                    
                      the combined Spotify data frame.
                      0:22
                    
                    
                      We will perform a left join on
the columns Name, Artists, and BB.Week.
                      0:25
                    
                    
                      bill_spot_final
                      0:41
                    
                    
                      = pd.merge(billboard_all,
                      0:46
                    
                    
                      spotify_all, how='left',
                      0:55
                    
                    
                      on=['Name', 'Artists',
                      1:03
                    
                    
                      'BB.Week']). Because this is a left join,
the final
                      1:10
                    
                    
                      data frame should have the same number
of rows as billboard_all, about 12,800.
                      1:17
                    
                    
                      bill_spot_final.shape. Good and
the first few rows
                      1:25
                    
                    
                      bill_spot_final.head().
                      1:40
                    
                    
                      There we go.
                      1:49
                    
                    
                      Great job.
                      1:50
                    
                    
                      In the last video, I'll share some
final thoughts on combining data.
                      1:52
                    
                    
                      See you soon.
                      1: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