Introduction to Pandas
Chapter 6: DataFrame methods
Append rows to DataFrame
You can append more rows to a DataFrame/Series
with the .append(other)
method. other
can be a DataFrame
or Series
or dict
-like object, or a list of these.
Note that this method returns a new DataFrame/Series
, rather than modifying the existing object.
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 = df.append(df) # Append the same Pokemon rows to DataFrame
>>> print(doubled_df.shape)
(1600, 12)