Hi,
I have a code with two dataframes types which are collected by simulation. I want to append these dataframes and store them into separated csv. When I print the dataframes within the loop, it was fine, but when I print the aggregated dataframe outside the loop, it is empty.
Any hint?
Thanks
I have a code with two dataframes types which are collected by simulation. I want to append these dataframes and store them into separated csv. When I print the dataframes within the loop, it was fine, but when I print the aggregated dataframe outside the loop, it is empty.
1 2 3 4 5 6 7 8 9 10 11 |
df1 = pd.DataFrame() df2 = pd.DataFrame() for i in range (n): df_temp1 = get_df1(i) df1.append(df_temp1, ignore_index = True ) df_temp2 = get_df2(i) df2.append(df_temp2,ignote_index = True ) df1.to_csv( 'f1.csv' ) df2.to_csv( 'f2.csv' ) |
Thanks