w3resource

Pandas DataFrame: append() function

DataFrame - append() function

The append() function is used to append rows of other to the end of caller, returning a new object.

Columns in other that are not in the caller are added as new columns.

Syntax:

DataFrame.append(self, other, ignore_index=False, verify_integrity=False, sort=None)

Parameters:

Name Description Type/Default Value Required / Optional
other           The data to append. DataFrame or Series/dict-like object, or list of these Required
ignore_index   If True, do not use the index labels. boolean
Default Value: False
Required
verify_integrity  If True, raise ValueError on creating index with duplicates. boolean
Default Value: False
Required
sort  Sort columns if the columns of self and other are not aligned. The default sorting is deprecated and will change to not-sorting in a future version of pandas. Explicitly pass sort=True to silence the warning and sort. Explicitly pass sort=False to silence the warning and not sort. boolean
Default Value: None
Required

Returns: DataFrame

Notes:

If a list of dict/series is passed and the keys are all contained in the DataFrame's index, the order of the columns in the resulting DataFrame will be unchanged.

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame - transpose() function
Next: DataFrame - assign() function



Follow us on Facebook and Twitter for latest update.