Chapter 6: DataFrame methods

Concatenating DataFrames

face Josiah Wang

You can concatenate multiple DataFrame/Series with the pandas.concat(objs) function. objs is a sequence of DataFrame or Series objects.

This function returns a new DataFrame/Series.

See the official documentation for more details and examples.

>>> df = pd.read_csv("pokemon.csv", index_col="Name")
>>> print(df.shape)
(800, 12)
>>> doubled_df = pd.concat([df, df])  # Concatenate two DataFrames (the same DataFrames in this case)
>>> print(doubled_df.shape)
(1600, 12)