Concatenating along with an axis

This is the first option. We'll use the pd.concat() method from the pandas library.

The code for combining the dataframes is as follows:

# Option 1dfSE = pd.concat([df1SE, df2SE], ignore_index=True)dfML = pd.concat([df1ML, df2ML], ignore_index=True)df = pd.concat([dfML, dfSE], axis=1)df

The code should be self-explanatory by now. We first concatenated the dataframes from the Software Engineering course and the Machine Learning course. Then, we concatenated the dataframes with axis=1 to place them side by side.

The output of the preceding code is as follows:

You probably noticed that the StudentID field is ...

Get Hands-On Exploratory Data Analysis with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.