-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwriteXLS.py
More file actions
28 lines (21 loc) · 738 Bytes
/
writeXLS.py
File metadata and controls
28 lines (21 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
field = ["Ford", "Ferrari"]
typ = ["Focus", "Rich Prick"]
length = [12, 256]
preci = [4, 0.2]
thisdict = {"Field": field,
"Type": typ,
"Length": length,
"Precision": preci
}
import pandas
# Create a Pandas dataframe from the data.
df = pandas.DataFrame(thisdict)
# Create a Pandas Excel writer using XlsxWriter as the engine.
writer = pandas.ExcelWriter(r'C:\Users\andolson\Documents\WORKING\pandas_simple.xlsx')
# Convert the dataframe to an XlsxWriter Excel object.
df.to_excel(writer, sheet_name='Sheet1')
# Close the Pandas Excel writer and output the Excel file.
# Output excel file is written in the same location where the
# script is saved.
writer.save()
print(thisdict)