Using the pd.merge() method with a left join

The third option is to use the pd.merge() method with the left join technique. By now, you should have understood the concept of a merge. The argument of the pd.merge() method allows us to use different types of joins.

These are the following types of joins:

Let's see how we can use the left outer join:

dfSE = pd.concat([df1SE, df2SE], ignore_index=True)
dfML = pd.concat([df1ML, df2ML], ignore_index=True)

df = dfSE.merge(dfML, how='left')
df

The output of the preceding code is as follows:

If you look at the preceding screenshot, you can correctly answer how many students only appeared for the Software Engineering course. The total number would be 26. Note that these students did not appear for the Machine Learning exam and hence their scores are marked as NaN.