Export a simple Dictionary into Excel file in python

0 votes

Python is new to me. I have a straightforward dictionary with the following key and values.

dict1 = {"number of storage arrays": 45, "number of ports":2390,......}

I need to get them in an excel sheet as follows:

number of storage arrays 45
number of ports          2390

I have a very big dictionary.

Oct 23 in Others by Kithuzzz
• 20,660 points
125 views

1 answer to this question.

0 votes

You can use pandas.

import pandas as pd

dict1 = {"number of storage arrays": 45, "number of ports":2390}

df = pd.DataFrame(data=dict1, index=[0])

df = (df.T)

print (df)

df.to_excel('dict1.xlsx')
answered Oct 23 by narikkadan
• 37,660 points

Related Questions In Others

0 votes
1 answer

Is there a function to unhide columns in excel through python

Excel file : df.to_excel('demofile.xlsx',index=False) import openpyxl py = openpyxl.load_workbook('demofile.xlsx') exlsheet = ...READ MORE

answered Oct 18 in Others by narikkadan
• 37,660 points
83 views
0 votes
1 answer
0 votes
1 answer

How to fix a circular reference error by if condition in excel file?

Circular reference in this context refers to ...READ MORE

answered Nov 21 in Others by narikkadan
• 37,660 points
28 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 3,149 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Convert table in a jpg image to excel using python

I believe you must execute OCR (optical ...READ MORE

answered Oct 16 in Others by narikkadan
• 37,660 points
270 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP