Data Science Asked on May 18, 2021
I have the following DataFrame and I want it exported in an excel file with different sheets having different words as shown in the image
0 2020-06-14 coronavirus es -0.021277 coronavirus is -0.006024
1 2020-06-13 coronavirus es -0.021277 coronavirus is 0.000000
2 2020-06-12 coronavirus es -0.021277 coronavirus is 0.000000
3 2020-06-11 coronavirus es -0.011111 coronavirus is 0.000000
4 2020-06-14 COVID-19 es 0.000000 COVID-19 is 0.000000
5 2020-06-13 COVID-19 es 0.000000 COVID-19 is 0.000000
6 2020-06-12 COVID-19 es 0.000000 COVID-19 is 0.000000
7 2020-06-11 COVID-19 es 0.000000 COVID-19 is 0.000000
I want to be able to export it to different sheets in an excel file in the following format
with the 1st sheet being as follows and the next having (COVID-19 es, COVID-19) and so on..
Date Coronavirus is coronavirus es
6/11/2020 0 -0.5
6/12/2020 0.05 0
6/13/2020 0 -0.5
6/14/2020 -0.05 -0.66
so far I have tried using pivot wr.pivot_table(columns=['query_x', 'query_y'])
but that does not give memy desired result and also trying to export it in different sheets is a bit confusing for me.
I have tried the following.
writer = pd.ExcelWriter(path, engine = 'xlsxwriter')
df1.to_excel(writer, sheet_name = 'b')
writer.save()
writer.close()
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP