Skip to content

Commit 8535b85

Browse files
author
Asifussain
committed
disabling the pandas option display.html.use_mathjax to process elements in the write_table method.
1 parent 56663cb commit 8535b85

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,8 @@ Other
778778
- Bug in :meth:`Series.replace` and :meth:`DataFrame.replace` inconsistently replacing matching instances when ``regex=True`` and missing values are present. (:issue:`56599`)
779779
- Bug in Dataframe Interchange Protocol implementation was returning incorrect results for data buffers' associated dtype, for string and datetime columns (:issue:`54781`)
780780
- Bug in ``Series.list`` methods not preserving the original :class:`Index`. (:issue:`58425`)
781+
- Bug in :meth:`write_table` not disabling the pandas option display.html.use_mathjax has issues with processing elements in this method. (:issue:`59884`)
782+
781783

782784
.. ***DO NOT USE THIS SECTION***
783785

pandas/io/formats/html.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ def _write_table(self, indent: int = 0) -> None:
241241
use_mathjax = get_option("display.html.use_mathjax")
242242
if not use_mathjax:
243243
_classes.append("tex2jax_ignore")
244+
_classes.append("mathjax_ignore")
244245
if self.classes is not None:
245246
if isinstance(self.classes, str):
246247
self.classes = self.classes.split()

pandas/tests/io/formats/style/test_style.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,11 @@ def test_repr_html_ok(self, styler):
488488
def test_repr_html_mathjax(self, styler):
489489
# gh-19824 / 41395
490490
assert "tex2jax_ignore" not in styler._repr_html_()
491+
assert "mathjax_ignore" not in styler._repr_html_()
491492

492493
with option_context("styler.html.mathjax", False):
493494
assert "tex2jax_ignore" in styler._repr_html_()
495+
assert "mathjax_ignore" in styler._repr_html_()
494496

495497
def test_update_ctx(self, styler):
496498
styler._update_ctx(DataFrame({"A": ["color: red", "color: blue"]}))

pandas/tests/io/formats/test_to_html.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,9 +934,11 @@ def test_repr_html(self, float_frame):
934934
def test_repr_html_mathjax(self):
935935
df = DataFrame([[1, 2], [3, 4]])
936936
assert "tex2jax_ignore" not in df._repr_html_()
937+
assert "mathjax_ignore" not in df._repr_html_()
937938

938939
with option_context("display.html.use_mathjax", False):
939940
assert "tex2jax_ignore" in df._repr_html_()
941+
assert "mathjax_ignore" in df._repr_html_()
940942

941943
def test_repr_html_wide(self):
942944
max_cols = 20

0 commit comments

Comments
 (0)