diff --git a/pandas/io/formats/style_render.py b/pandas/io/formats/style_render.py index 08d9fd938c873..4ee0bb8d626bc 100644 --- a/pandas/io/formats/style_render.py +++ b/pandas/io/formats/style_render.py @@ -867,6 +867,8 @@ def _translate_latex(self, d: dict, clines: str | None) -> None: """ index_levels = self.index.nlevels visible_index_level_n = index_levels - sum(self.hide_index_) + if visible_index_level_n == 0: + visible_index_level_n = 1 d["head"] = [ [ {**col, "cellstyle": self.ctx_columns[r, c - visible_index_level_n]}