Javatpoint Logo
Javatpoint Logo

Pandas DataFrame.append()

The Pandas append() function is used to add the rows of other dataframe to the end of the given dataframe, returning a new dataframe object. The new columns and the new cells are inserted into the original DataFrame that are populated with NaN value.

Syntax:

Parameters:

  • other: DataFrame or Series/dict-like object, or a list of these
    It refers to the data to be appended.
  • ignore_index: If it is true, it does not use the index labels.
  • verify_integrity: If it is true, it raises ValueError on creating an index with duplicates.
  • sort: It sorts the columns if the columns of self and other are not aligned. The default sorting is deprecated, and it will change to not-sorting in a future version of pandas. We pass sort=True Explicitly for silence the warning and the sort, whereas we pass sort=False Explicitly for silence the warning and not the sort.

Returns:

It returns the appended DataFrame as an output.

Example1:

Output

     x       y      z
0    25      47     NaN  
1    15      24     NaN
2    12      17     NaN
3    19      29     NaN
4    25      47     38.0
5    15      24     12.0
6    12      17     45.0

Example2:

Output

     x     y
0    15   24
1    25   38
2    37   18
3    42   45
4    15   24
5    25   38
6    37   45

Next TopicDataFrame.apply()





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA