BUG: using a list in "selector" for set_table_styles produces wrong rules #34061
Closed
2 of 3 tasks
Labels
Bug
IO HTML
read_html, to_html, Styler.apply, Styler.applymap
Needs Info
Clarification about behavior needed to assess issue
Styler
conditional formatting using DataFrame.style
Milestone
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.
Problem description
Example: I want to apply a style like this:
df.style.set_table_styles([{'selector': 'th.col_heading,th.blank', 'props': [('display', 'none')]}])
Note a list (
th.col_heading,th.blank
) as selector. This produces wrong CSS, because UUID of the table is only prepended once to this selector:i.e. all
th.blank
elements in all tables on the page are hidden. This is not exactly intuitive, although the workaround is simple: you need to writeset_table_styles([{'selector': 'th.col_heading', 'props': [('display', 'none')]}, {'selector': 'th.blank', 'props': [('display', 'none')]}])
INSTALLED VERSIONS
commit : None
python : 3.8.2.final.0
python-bits : 64
OS : Linux
OS-release : 5.6.10-arch1-1
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.0.3
numpy : 1.18.4
pytz : 2020.1
dateutil : 2.8.1
pip : 20.0.2
setuptools : 46.1.3
Cython : None
pytest : 5.4.1
hypothesis : None
sphinx : 3.0.3
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.5.0
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.14.0
pandas_datareader: None
bs4 : 4.9.0
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.5.0
matplotlib : 3.2.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : 5.4.1
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : 1.3.16
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : None
numba : None
The text was updated successfully, but these errors were encountered: