how to save a dictionary to excel in python
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')
how to save a dictionary to excel in python
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')
python list of dictionaries to excel
from csv import DictWriter
players = [{'dailyWinners': 3, 'dailyFreePlayed': 2, 'user': 'Player1', 'bank': 0.06},
{'dailyWinners': 3, 'dailyFreePlayed': 2, 'user': 'Player2', 'bank': 4.0},
{'dailyWinners': 1, 'dailyFree': 2, 'user': 'Player3', 'bank': 3.1},
{'dailyWinners': 3, 'dailyFree': 2, 'user': 'Player4', 'bank': 0.32}]
with open('spreadsheet.csv','w') as outfile:
writer = DictWriter(outfile, ('dailyWinners','dailyFreePlayed','dailyFree','user','bank'))
writer.writeheader()
writer.writerows(players)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us