I Am running the same pandas script on 100+ subjects, but I need to put all of them into the same sheet vertically.
Both of these are labeled as "score" in my script, as it loops through the script once for the first score, and then produces the 2nd DF for the 2nd score. I need it to save the first score in the excel sheet, and then append the 2nd and many more scores below it
here is score 1:
labelCTBIN001v1 Overall Stress Score Stress Score Short-Term Stress Risk Future Stress Risk Chronic Stress Risk
scoreCTBIN001v1 57 49 54 66 60
and here is score 2:
labelCTBIN003v1 Overall Stress Score Stress Score Short-Term Stress Risk Future Stress Risk Chronic Stress Risk
scoreCTBIN003v1 57 52 52 65 59
I'm just looking for something like this in an excel sheet:
labelCTBIN001v1 Overall Stress Score Stress Score Short-Term Stress Risk Future Stress Risk Chronic Stress Risk
scoreCTBIN001v1 57 49 54 66 60
labelCTBIN003v1 Overall Stress Score Stress Score Short-Term Stress Risk Future Stress Risk Chronic Stress Risk
scoreCTBIN003v1 57 52 52 65 59
I've tried doing the following to write to excel sheets for pandas,
with pd.ExcelWriter('Scores.xlsx',mode='a',if_sheet_exists='overlay') as writer:
(score.transpose()).to_excel(writer, sheet_name='Scores_new')
in the docs it stats "mode='a'" is used to append to a sheet, however it is always overwritten with the latest subjects data.