The code below is what I have so far, thanks to Luis from my
CodePudding user response:
This works for me:
results = []
for i in companies:
result = company_metrics[i].iloc[:, 0]
results.append(result)
Then build the dataframe:
df = pd.DataFrame(results).T
df.columns = companies
Lastly, build the excel:
df.to_excel('Output.xlsx')