How to concatenate and merge a dataset in Python?
Concatenation is joining of two datasets either horizontally or vertically. Merging is merging two or more datasets based on a common column
Let us make a dataframe and illustrate concatenation and merging.
Now we have created three data frames in which we will perform concatenation
Here all the data frames are joined horizontally by setting axis=1.
Now we will be performing merging on different data frames.
Now merging will be performed on the left and right dataframes.
Here ‘inner’ is performed to keep the common column ‘key’ of left and right dataframes inside.