@@ -2726,8 +2726,8 @@ def duplicated(self, subset=None, take_last=False):
27262726 Only consider certain columns for identifying duplicates, by
27272727 default use all of the columns
27282728 take_last : boolean, default False
2729- For a set of distinct duplicate rows, flag all but the last row as
2730- duplicated. Default is for all but the first row to be flagged
2729+ For a set of distinct duplicate rows, flag all but the last row as
2730+ duplicated. Default is for all but the first row to be flagged
27312731 cols : kwargs only argument of subset [deprecated]
27322732
27332733 Returns
@@ -3770,35 +3770,65 @@ def infer(x):
37703770
37713771 def append (self , other , ignore_index = False , verify_integrity = False ):
37723772 """
3773- Append columns of other to end of this frame's columns and index,
3774- returning a new object. Columns not in this frame are added as new
3775- columns.
3773+ Append rows of `other` to the end of this frame, returning a new
3774+ object. Columns not in this frame are added as new columns.
37763775
37773776 Parameters
37783777 ----------
3779- other : DataFrame or list of Series/dict-like objects
3778+ other : DataFrame or Series/dict-like object, or list of these
3779+ The data to append.
37803780 ignore_index : boolean, default False
3781- If True do not use the index labels. Useful for gluing together
3782- record arrays
3781+ If True, do not use the index labels.
37833782 verify_integrity : boolean, default False
3784- If True, raise ValueError on creating index with duplicates
3783+ If True, raise ValueError on creating index with duplicates.
3784+
3785+ Returns
3786+ -------
3787+ appended : DataFrame
37853788
37863789 Notes
37873790 -----
3788- If a list of dict is passed and the keys are all contained in the
3791+ If a list of dict/series is passed and the keys are all contained in the
37893792 DataFrame's index, the order of the columns in the resulting DataFrame
3790- will be unchanged
3793+ will be unchanged.
3794+
3795+ See also
3796+ --------
3797+ pandas.concat : General function to concatenate DataFrame, Series
3798+ or Panel objects
3799+
3800+ Examples
3801+ --------
3802+
3803+ >>> df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB'))
3804+ >>> df
3805+ A B
3806+ 0 1 2
3807+ 1 3 4
3808+ >>> df2 = pd.DataFrame([[5, 6], [7, 8]], columns=list('AB'))
3809+ >>> df.append(df2)
3810+ A B
3811+ 0 1 2
3812+ 1 3 4
3813+ 0 5 6
3814+ 1 7 8
3815+
3816+ With `ignore_index` set to True:
3817+
3818+ >>> df.append(df2, ignore_index=True)
3819+ A B
3820+ 0 1 2
3821+ 1 3 4
3822+ 2 5 6
3823+ 3 7 8
37913824
3792- Returns
3793- -------
3794- appended : DataFrame
37953825 """
37963826 if isinstance (other , (Series , dict )):
37973827 if isinstance (other , dict ):
37983828 other = Series (other )
37993829 if other .name is None and not ignore_index :
3800- raise TypeError ('Can only append a Series if '
3801- 'ignore_index=True ' )
3830+ raise TypeError ('Can only append a Series if ignore_index=True '
3831+ ' or if the Series has a name ' )
38023832
38033833 index = None if other .name is None else [other .name ]
38043834 combined_columns = self .columns .tolist () + self .columns .union (other .index ).difference (self .columns ).tolist ()
0 commit comments