Feb-28-2022, 04:27 PM
This doesn't work either:
# 1) This works fine: Oh no it doesn't! df1 = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB')) df2 = pd.DataFrame([[5, 6], [7, 8]], columns=list('AB')) df1.append(df2) print(df1)
Output: A B
0 1 2
1 3 4
In both cases .append() creates a new dataframe instead of modifying the dataframe in place.