I am writing a script in which I want the output to be an Excel sheet with auto-fitted column width's. Further, I want the index column's title to appear.
Right now, I run the script and the Excel sheet populates with auto-fitted column width's, but the index column's title does not appear. Is there a quick fix for this?
for type in tickers:
df5 = pd.DataFrame(df4.diff(periods=1, axis=0))
frames = [df4.iloc[-2,:],df4.iloc[-1,:],df5.iloc[-1,:]]
df6 = pd.concat(frames, axis=1, ignore_index=True)
df6 = round(df6, 2)
df6.columns = ["Last Week ($mm/bp)", "This Week ($mm/bp)", "Change ($mm/bp)"]
df6.index.name = "{}".format(type)
df6 = df6.reindex(index = ["ED1 Comdty", "TU1 Comdty", "FV1 Comdty", "TY1 Comdty", "UXY1 Comdty", "US1 Comdty", "WN1 Comdty", "Total"])
sf = StyleFrame(df6)
sf.to_excel(writer, sheet_name=type, index=True)
writer.save()