![]() |
VOOZH | about |
Pandas DataFrame consists of three principal components, the data, rows, and columns. To combine these DataFrames, pandas provides multiple functions like concat() and append().
Method #1: Using concat() method
Initially, creating two datasets and converting them into dataframes.
Output:
Now, concatenating the two dataframes, we will use concat() to combine two dataframes. If ignore_index = True the index of df will be in a continuous order.
Output:
Using keys we can specify the labels of the dataframes.
Output:
Method #2: Using append() method
Initially, creating two datasets and converting them into dataframes.
Output:
The dataframe.append() method performs the operation of combining two dataframes similar to that of the concat() method.
Output: