Home > Enterprise >  Empty Dataframe after appening
Empty Dataframe after appening

Time:02-18

I have the following code :

df = df_final[['p1','p2']].copy()
dff = df_final[['p2','p3']].copy()
dfff = df_final[['p3','p1']].copy()

df_input_output = pd.DataFrame(columns = range(2))
df_input_output.columns = ['1','2']

df_input_output.append(df,ignore_index=True)
df_input_output.append(dff,ignore_index=True)
df_input_output.append(dfff,ignore_index=True)

print(df_input_output)

That returns : error_code

I don't know why, i checked the copy() function worked and there's values in df,dff,dfff.

Thanks in advance, Alexandre

CodePudding user response:

You need to capture the return value

df_input_output = df_input_output.append(df,ignore_index=True)
df_input_output = df_input_output.append(dff,ignore_index=True)
df_input_output = df_input_output.append(dfff,ignore_index=True)
  • Related