diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index 877e146fd8681..be748dfbdb2d6 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -466,7 +466,7 @@ def _translate(self): } colspan = col_lengths.get((r, c), 0) if colspan > 1: - es["attributes"] = [f'colspan="{colspan}"'] + es["attributes"] = f'colspan="{colspan}"' row_es.append(es) head.append(row_es) @@ -517,7 +517,7 @@ def _translate(self): } rowspan = idx_lengths.get((c, r), 0) if rowspan > 1: - es["attributes"] = [f'rowspan="{rowspan}"'] + es["attributes"] = f'rowspan="{rowspan}"' row_es.append(es) for c, col in enumerate(self.data.columns): @@ -529,6 +529,7 @@ def _translate(self): "value": value, "display_value": formatter(value), "is_visible": (c not in hidden_columns), + "attributes": "", } # only add an id if the cell has a style diff --git a/pandas/io/formats/templates/html.tpl b/pandas/io/formats/templates/html.tpl index b315c57a65cdf..65fc1dfbb37c4 100644 --- a/pandas/io/formats/templates/html.tpl +++ b/pandas/io/formats/templates/html.tpl @@ -39,7 +39,7 @@