diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 2941b6ac01904..d90487647d35b 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -8793,6 +8793,7 @@ def append( Returns ------- DataFrame + A new DataFrame consisting of the rows of caller and the rows of `other`. See Also -------- @@ -8811,18 +8812,18 @@ def append( Examples -------- - >>> df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB')) + >>> df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB'), index=['x', 'y']) >>> df A B - 0 1 2 - 1 3 4 - >>> df2 = pd.DataFrame([[5, 6], [7, 8]], columns=list('AB')) + x 1 2 + y 3 4 + >>> df2 = pd.DataFrame([[5, 6], [7, 8]], columns=list('AB'), index=['x', 'y']) >>> df.append(df2) A B - 0 1 2 - 1 3 4 - 0 5 6 - 1 7 8 + x 1 2 + y 3 4 + x 5 6 + y 7 8 With `ignore_index` set to True: