I am trying to store a List of dict to excel using pandas. Somehow I am not getting how to do it.
lstofdic = [{'96': ['1/3/21', '1/3/22']}, {'97': ['1/3/20']}, {'98': []}, {'180': ['1/4/7']}, {'181': []}]
I tried like below
import pandas as pd
writer = pd.ExcelWriter("out.xlsx")
for l in lstofdic:
pd.DataFrame(l.keys(),l.values()).to_excel(writer, header=['vlan','port'], sheet_name='sheet1', index=False)
writer.save()
Kindly help to solve my issue. Thanks in advance.
