I declared an empty data frame near the top of my file with a global scope:
final_df = pd.DataFrame()
I have stats_dfsuccessfully printing the correct value, but final_df is not changing after appending stats_df to it:
stats_df = pd.DataFrame(X, columns=stats_feature_names).sum().to_frame().T
print('statsdf being appended: \n', stats_df)
print('final_df before append: \n', final_df)
final_df.append(stats_df)
print('final_df after append: \n', final_df)
The output of these print statements are:
statsdf being appended:
GF GA
0 14 33
final_df before append:
Empty DataFrame
Columns: []
Index: []
final_df after append:
Empty DataFrame
Columns: []
Index: []
When it should be:
statsdf being appended:
GF GA
0 14 33
final_df before append:
Empty DataFrame
Columns: []
Index: []
final_df after append:
GF GA
0 14 33
Why is stats_df not being appended to final_df?