Skip to content

Commit c66226d

Browse files
committed
Fixes to document issue in code, small efficiency fix
1 parent 15e2c97 commit c66226d

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

pandas/core/format.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1874,7 +1874,7 @@ def _format_hierarchical_rows(self):
18741874
# MultiIndex columns require an extra row
18751875
# with index names (blank if None) for
18761876
# unambigous round-trip, unless not merging,
1877-
# in which case the names all go on one row
1877+
# in which case the names all go on one row Issue #11328
18781878
if isinstance(self.columns, MultiIndex) and self.merge_cells:
18791879
self.rowcounter += 1
18801880

pandas/io/excel.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,9 @@ def write_cells(self, cells, sheet_name=None, startrow=0, startcol=0):
708708
for cell in cells:
709709
colletter = get_column_letter(startcol + cell.col + 1)
710710
xcell = wks.cell("%s%s" % (colletter, startrow + cell.row + 1))
711-
new_data_type = xcell.data_type_for_value(cell.val)
712711
if (isinstance(cell.val, compat.string_types)
713-
and new_data_type != xcell.TYPE_STRING):
712+
and xcell.data_type_for_value(cell.val)
713+
!= xcell.TYPE_STRING):
714714
xcell.set_value_explicit(cell.val)
715715
else:
716716
xcell.value = _conv_value(cell.val)

pandas/io/tests/test_excel.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,10 @@ def test_to_excel_multiindex(self):
10891089
df = read_excel(reader, 'test1', index_col=[0, 1],
10901090
parse_dates=False)
10911091
tm.assert_frame_equal(frame, df)
1092-
1092+
1093+
# Test for Issue 11328. If column indices are integers, make
1094+
# sure they are handled correctly for either setting of
1095+
# merge_cells
10931096
def test_to_excel_multiindex_cols(self):
10941097
_skip_if_no_xlrd()
10951098

0 commit comments

Comments
 (0)