Read from Excel and convert the output to dictionary in Python

18 views
Skip to first unread message

Srinivas G

unread,
Oct 29, 2018, 2:09:07 AM10/29/18
to PANDA Project Users
import os
import datetime
import pandas as pd
import xlrd
df = pd.read_excel("m2.xlsx")
print(df)

 Date 05:00 A.M 06:00A.M 23-09-2018 8 1 24-09-2018 3 4

My out put should be in Dictionary format.(Where Label in Excel should be my keys and the remaining should be my values in dictionary format as shown below.

{'Date':['23-08-2018','24-08-2018'],'05:00 A.M':[8,3],'06:00 A.M':[1,4]}

m2.xlsx

Justin Myers

unread,
Oct 29, 2018, 8:31:30 AM10/29/18
to Srinivas G, PANDA Project Users
Hi! This list is for PANDA, a web application for data journalists: http://pandaproject.net/

For pandas, the analysis library, you might want to try one of the links here: http://pandas.pydata.org/community.html
-Justin
--
You received this message because you are subscribed to the Google Groups "PANDA Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to panda-project-u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Email had 1 attachment:

  • m2.xlsx
      11k (application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)

Reply all
Reply to author
Forward
0 new messages