March 2020
Beginner to intermediate
352 pages
8h 40m
English
This is the second option. Let's now use the df.merge() method from the pandas library. The idea is simple. First of all, we concatenate the individual dataframes from each of the subjects, and then we use df.merge() methods.
Check the following code:
dfSE = pd.concat([df1SE, df2SE], ignore_index=True)dfML = pd.concat([df1ML, df2ML], ignore_index=True)df = dfSE.merge(dfML, how='inner')df
Here, you performed an inner join on each dataframe. That is to say, if an item exists in both dataframes, it will be included in the new dataframe. This means we will get a list of students who appeared in both the courses.
The output of the preceding code is shown in the following screenshot:
Note that this should answer ...
Read now
Unlock full access