Why can't I append pandas dataframe in a loop

This happens because the .append() method returns a new df:

Pandas Docs (0.19.2):

pandas.DataFrame.append

Returns: appended: DataFrame

Here's a working example so you can see what's happening in each iteration of the loop:

df1 = pd.DataFrame([[1,2],], columns=['a','b'])
df2 = pd.DataFrame()
for i in range(0,2):
    print(df2.append(df1))

>    a  b
> 0  1  2
>    a  b
> 0  1  2

If you assign the output of .append() to a df (even the same one) you'll get what you probably expected:

for i in range(0,2):
    df2 = df2.append(df1)
print(df2)

>    a  b
> 0  1  2
> 0  1  2