I calculated a 95% confidence interval in Python with this code:
d = st.t.interval(alpha=0.95, df=len(df_efw)-1, loc=np.mean(df_efw).mean(), scale=st.sem(df_efw.stack()))
My output is: (2540.3603658087004, 2640.3233923612343)
I want to convert this into an exisiting excel sheet with this code:
ws.cell(row=4, column= 3).value = d
But my error is: ValueError: Cannot convert (2540.3603658087004, 2640.3233923612343) to Excel
How can i convert it to excel? I would prefer it if i can convert a single data in one cell (2530,36 is in C4 and 2640,32 is in C5).
CodePudding user response:
Using the row and column notation, access the tuple items individually and increment the row when writing with ws.cell
.
ws.cell(row=4, column= 3).value = d[0] # C4
ws.cell(row=5, column= 3).value = d[1] # C5