O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Concatenating rows

The rows from multiple DataFrame objects can be concatenated to each other using the pd.concat() function and by specifying axis=0. The default operation of pd.concat() on two DataFrame objects along the row axis operates in the same way as the .append() method.

This is demonstrated by reconstructing the two datasets from the earlier append example and concatenating them instead.

If the set of columns in all DataFrame objects is not identical, pandas will fill those values with NaN.

Duplicate index labels can result as the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required