diff --git a/pandas/formats/format.py b/pandas/formats/format.py index 83fc66a0b8f22..4b51c71a2c042 100644 --- a/pandas/formats/format.py +++ b/pandas/formats/format.py @@ -1841,7 +1841,11 @@ def _format_regular_rows(self): for idx, idxval in enumerate(index_values): yield ExcelCell(self.rowcounter + idx, 0, idxval, header_style) - for cell in self._generate_body(coloffset=1): + coloffset = 1 + else: + coloffset = 0 + + for cell in self._generate_body(coloffset): yield cell def _format_hierarchical_rows(self): @@ -1907,7 +1911,7 @@ def _format_hierarchical_rows(self): indexcolval, header_style) gcolidx += 1 - for cell in self._generate_body(coloffset=gcolidx): + for cell in self._generate_body(gcolidx): yield cell def _generate_body(self, coloffset):