diff --git a/pandas/core/style.py b/pandas/core/style.py index a5a42c2bb47a7..19aa36fa005d0 100644 --- a/pandas/core/style.py +++ b/pandas/core/style.py @@ -237,7 +237,7 @@ def _translate(self): cs = [DATA_CLASS, "row%s" % r, "col%s" % c] cs.extend(cell_context.get("data", {}).get(r, {}).get(c, [])) row_es.append({"type": "td", - "value": self.data.iloc[r][c], + "value": self.data.iloc[r, c], "class": " ".join(cs), "id": "_".join(cs[1:])}) props = [] diff --git a/pandas/tests/test_style.py b/pandas/tests/test_style.py index b9ca3f331711d..f8a6a467a8f0e 100644 --- a/pandas/tests/test_style.py +++ b/pandas/tests/test_style.py @@ -164,6 +164,12 @@ def test_multiindex_name(self): self.assertEqual(result['head'], expected) + def test_numeric_columns(self): + # https://github.com/pydata/pandas/issues/12125 + # smoke test for _translate + df = pd.DataFrame({0: [1, 2, 3]}) + df.style._translate() + def test_apply_axis(self): df = pd.DataFrame({'A': [0, 0], 'B': [1, 1]}) f = lambda x: ['val: %s' % x.max() for v in x]