when i go to write my for loop generated dataframes to an excel file, only the last line is written into the excel file. i have tried concatenating the dataframes, as each iteration creates a new data frame and then write it to the excel file.
so essentially what i am looking to do is, to successfully concatenate the data frames into one dataframe before i write them to the excel file. i cant write them in individually using pd.ExcelWriter, as I may have 100's of feature names
def CCC_90(df_1,x):
for i in x:
print('------------------------------------------------------------------------------------------------------------------- ')
feature_num =(df_1.iloc[[i]])
feature_num_correct = (feature_num + 21)
print(feature_num_correct)
writer = pd.ExcelWriter('No3_dVSa.xlsx', engine='xlsxwriter')
appended_data = []
for j in feature_num:
feature_name = dfFeaturename.iloc[[j]]
appended_data.append(feature_name)
appended_data = pd.concat(appended_data)
appended_data.to_excel(writer, sheet_name='Sheet1',startrow=1)
writer.save()