Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.1.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Fixed regressions
Bug fixes
~~~~~~~~~

- Bug in ``Styler`` whereby `cell_ids` argument had no effect due to other recent changes (:issue:`35588`).

Categorical
^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def format_attr(pair):
"is_visible": (c not in hidden_columns),
}
# only add an id if the cell has a style
if self.cell_ids or not (len(ctx[r, c]) == 1 and ctx[r, c][0] == ""):
if self.cell_ids or (r, c) in ctx:
row_dict["id"] = "_".join(cs[1:])
row_es.append(row_dict)
props = []
Expand Down
6 changes: 6 additions & 0 deletions pandas/tests/io/formats/test_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -1682,6 +1682,12 @@ def f(a, b, styler):
result = styler.pipe((f, "styler"), a=1, b=2)
assert result == (1, 2, styler)

def test_no_cell_ids(self):
# GH 35588
df = pd.DataFrame(data=[[0]])
s = Styler(df, uuid="_", cell_ids=False).render()
assert s.find('<td class="data row0 col0" >') != -1


@td.skip_if_no_mpl
class TestStylerMatplotlibDep:
Expand Down