...

/

Concatenation

Concatenation

pandas provides some useful utilities to combine data from multiple files. Let's see how to use them.

append() with same column

In real life, data comes from different sources, combining them together into a single DataFrame is very useful.

Let’s begin with a very simple scenario.

There are two DataFrame structures with the same row index. Your job is to combine these two DataFrames into one by adding their columns side by side. Before trying it in pandas, do you remember how to do it using the native Python list? We would use append() to add items to a Python list. In pandas, we use concat() for this. It concatenates the two DataFrame objects along axis=1, namely the columns.

Notice:

  • In the example, the function only accepts one DataFrame. However, multiple DataFrames can be
...