BUG: DataFrame.style.bar.to_latex
does not output valid LaTeX
#54082
Labels
Closing Candidate
May be closeable, needs more eyeballs
IO LaTeX
to_latex
Styler
conditional formatting using DataFrame.style
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
Issue Description
The output of the code above is
Expected Behavior
This does not look like valid LaTeX at all.
width10em
.-
. Here it looks like\backgroundlinear-gradient
is supposed to correspond to something but ends up calling a LaTeX command called\backgroundlinear
.(90deg, #d65f5f 100.0%, transparent 100.0%)
looks incorrect.%
, so the line above becomes0 & \width10em \backgroundlinear-gradient(90deg, #d65f5f 100.0
.Undefined control sequence
.Installed Versions
INSTALLED VERSIONS
commit : 2e218d1
python : 3.9.15.final.0
python-bits : 64
OS : Linux
OS-release : 3.10.0-1160.62.1.el7.x86_64
Version : #1 SMP Tue Apr 5 13:02:25 PDT 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.5.3
numpy : 1.24.1
pytz : 2022.7.1
dateutil : 2.8.2
setuptools : 66.1.1
pip : 23.0
Cython : None
pytest : 7.2.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.9.2
html5lib : None
pymysql : 1.0.3
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.9.0
pandas_datareader: None
bs4 : 4.11.2
bottleneck : None
brotli :
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.6.3
numba : None
numexpr : None
odfpy : None
openpyxl : 3.1.0
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.10.0
snappy : None
sqlalchemy : 2.0.16
tables : None
tabulate : 0.9.0
xarray : None
xlrd : 2.0.1
xlwt : None
zstandard : 0.19.0
tzdata : None
The text was updated successfully, but these errors were encountered: