df.append() is not appending to the DataFrame

DataFrame.append is not an in-place operation. From the docs,

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

Append rows of other to the end of this frame, returning a new object.
Columns not in this frame are added as new columns.

You need to assign the result back.

df8 = df8.append([s] * 2, ignore_index=True)
df8
          A         B         C         D
0  value aa  value bb  value cc  value dd
1  value aa  value bb  value cc  value dd

Leave a Comment