Skip to content

Commit 5759093

Browse files
locojaydevwesm
locojaydev
authored andcommitted
large files
1 parent f4108b7 commit 5759093

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pandas/io/parsers.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import pandas.lib as lib
2222
import pandas._parser as _parser
2323
from pandas.tseries.period import Period
24+
import json
25+
2426

2527
class DateConversionError(Exception):
2628
pass
@@ -2125,14 +2127,24 @@ def _writecells_xls(self, cells, sheet_name, startrow, startcol):
21252127
wks = self.book.add_sheet(sheet_name)
21262128
self.sheets[sheet_name] = wks
21272129

2130+
style_dict = {}
2131+
21282132
for cell in cells:
21292133
val = _conv_value(cell.val)
2130-
style = CellStyleConverter.to_xls(cell.style)
2134+
2135+
stylekey = json.dumps(cell.style)
2136+
if stylekey in style_dict:
2137+
style = style_dict[stylekey]
2138+
else:
2139+
style = CellStyleConverter.to_xls(cell.style)
2140+
style_dict[stylekey] = style
2141+
21312142
if isinstance(val, datetime.datetime):
21322143
style.num_format_str = "YYYY-MM-DD HH:MM:SS"
21332144
elif isinstance(val, datetime.date):
21342145
style.num_format_str = "YYYY-MM-DD"
21352146

2147+
21362148
if cell.mergestart is not None and cell.mergeend is not None:
21372149
wks.write_merge(startrow + cell.row,
21382150
startrow + cell.mergestart,

0 commit comments

Comments
 (0)