Count of 2 dataframes

Question:

I have 2 dataframes of top songs both on spotify and tiktok. In those dataframes I have colums with the names of the top songs of 2022 and I was wondering how to know the amount of songs that are on both columns of the separate dataframes.

I haven’t really try much cause I don’t know where to start.

Asked By: Hugo De Francisco

||

Answers:

One approach is to convert song names columns in both dataframes to set, and then union them with each other

set(spotify_df.songName).union(set(tiktok_df.songName))
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.