Skip to content

BUG: Minor HTML formatting error in Styler.render(): rowspan attribute should use quotes #38234

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

Closed
3 tasks done
fwt opened this issue Dec 2, 2020 · 2 comments
Closed
3 tasks done
Labels
Bug Styler conditional formatting using DataFrame.style
Milestone

Comments

@fwt
Copy link

fwt commented Dec 2, 2020

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

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

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

df = pd.DataFrame(data=[[1, 2]], index=[["l0", "l0"], ["l1a", "l1b"]])
s = Styler(df, uuid="_", cell_ids=False)
assert '<th id="T__level0_row0" class="row_heading level0 row0" rowspan="2">l0</th>' in s.render()

Problem description

This issue is very similar to #35706. The colspan attribute has been fixed in #36223 but the rowspan attribute hasn't been fixed yet. Fixing this would improve HTML correctness and make the Styler.render() behavior more consistent.

Compare line 330 (colspan attribute) and line 376 (rowspan attribute).

Expected Output

The rowspan attribute uses quotes and the assert statement doesn't fail.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : db08276
python : 3.8.5.final.0
python-bits : 64
OS : Linux
OS-release : 4.19.76-linuxkit
Version : #1 SMP Tue May 26 11:42:35 UTC 2020
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.1.3
numpy : 1.19.2
pytz : 2020.1
dateutil : 2.8.1
pip : 20.1.1
setuptools : 50.3.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.18.1
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None

@fwt fwt added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 2, 2020
@JoseNavy
Copy link
Contributor

I was able to reproduce this bug in master, so I will try to fix it!

@jreback jreback added this to the 1.2 milestone Dec 22, 2020
@jreback jreback added Styler conditional formatting using DataFrame.style and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 22, 2020
@simonjayhawkins
Copy link
Member

closed in #38533

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Styler conditional formatting using DataFrame.style
Projects
None yet
Development

No branches or pull requests

4 participants