Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Disabling pandas option display.html.use_mathjax has no effect #59884

Open
2 of 3 tasks
niklassemmler opened this issue Sep 25, 2024 · 5 comments · May be fixed by #59948 or #60043
Open
2 of 3 tasks

BUG: Disabling pandas option display.html.use_mathjax has no effect #59884

niklassemmler opened this issue Sep 25, 2024 · 5 comments · May be fixed by #59948 or #60043
Assignees
Labels
Bug good first issue Output-Formatting __repr__ of pandas objects, to_string

Comments

@niklassemmler
Copy link

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
pd.set_option('display.html.use_mathjax', False)
pd.DataFrame([
    "$2.13 dont_make_this_math $5.24"
])

Issue Description

My pandas data frames contain text columns which contain dollar signs. I need to be represented as raw strings not as a math-formatted picture.

Pandas provides the option display.html.use_mathjax to this end. However, setting the option does not change pandas behavior. Even with the config set the string "$2.13 dont_make_this_math $5.24" has its spaces removed and text after _ subscripted.

I understand this can be managed by explicitly escaping dollar signs in any text column I come across, but this is a lot of overhead.

Expected Behavior

Screenshot 2024-09-25 at 10 52 27

not as

Screenshot 2024-09-25 at 10 52 18

Installed Versions

INSTALLED VERSIONS

commit : 0691c5c
python : 3.11.9
python-bits : 64
OS : Darwin
OS-release : 23.6.0
Version : Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 2.2.3
numpy : 1.26.4
pytz : 2024.1
dateutil : 2.9.0.post0
pip : 23.3.1
Cython : None
sphinx : None
IPython : 8.27.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.12.3
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : 3.1.4
lxml.etree : None
matplotlib : 3.9.2
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : 15.0.2
pyreadstat : None
pytest : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2024.1
qtpy : None
pyqt5 : None

@niklassemmler niklassemmler added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 25, 2024
@rhshadrach
Copy link
Member

Thanks for the report! pandas currently uses tex2jax_ignore but it appears this changed in MathJax 3.0, at least according to this:

https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#mathjax-and-math-parsing

However, I cannot find such a change mentioned in MathJax release notes. In any case, changing from tex2jax_ignore to mathjax_ignore seems to resolve. For backwards compatibility with MathJax 2.0, perhaps we should merely add mathjax_ignore rather than replacing tex2jax_ignore. I don't believe an extra unused CSS class will harm anything.

PRs to fix are welcome!

@rhshadrach rhshadrach added Output-Formatting __repr__ of pandas objects, to_string good first issue and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 30, 2024
@vivrdprasanna
Copy link

take

@JustinCapili
Copy link

take

@JustinCapili JustinCapili linked a pull request Oct 3, 2024 that will close this issue
5 tasks
@Asifussain
Copy link

take

@Maru5er
Copy link

Maru5er commented Oct 11, 2024

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment