Pandas style render set_uuid sets Multiple ids
See original GitHub issueCode Sample, a copy-pastable example if possible
df = pd.DataFrame({'a': [1, 3, 5, 6], 'b': [2, 4, 12, 21]})
df.style.render(uuid='test')
## or same with df.style.set_uuid('test').render()
<style type="text/css" >\n</style> \n<table id="T_test" > \n<thead> <tr> \n <th class="blank level0" ></th> \n <th class="col_heading level0 col0" >a</th> \n <th class="col_heading level0 col1" >b</th> \n </tr></thead> \n<tbody> <tr> \n <th id="T_test" class="row_heading level0 row0" >0</th> \n <td id="T_testrow0_col0" class="data row0 col0" >1</td> \n <td id="T_testrow0_col1" class="data row0 col1" >2</td> \n </tr> <tr> \n <th id="T_test" class="row_heading level0 row1" >1</th> \n <td id="T_testrow1_col0" class="data row1 col0" >3</td> \n <td id="T_testrow1_col1" class="data row1 col1" >4</td> \n </tr> <tr> \n <th id="T_test" class="row_heading level0 row2" >2</th> \n <td id="T_testrow2_col0" class="data row2 col0" >5</td> \n <td id="T_testrow2_col1" class="data row2 col1" >12</td> \n </tr> <tr> \n <th id="T_test" class="row_heading level0 row3" >3</th> \n <td id="T_testrow3_col0" class="data row3 col0" >6</td> \n <td id="T_testrow3_col1" class="data row3 col1" >21</td> \n </tr></tbody> \n</table>
Problem description
I am told that a css id should be unique and therefore, when <table id="T_test" >
and <th id="T_test"...>
in the above HTML output have the same ids, this breaks my css and causes the settings on my ids to be ignored.
Output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 3.16.0-4-amd64
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: en_GB.UTF-8
pandas: 0.20.2 pytest: 2.9.2 pip: 9.0.1 setuptools: 27.2.0 Cython: 0.24.1 numpy: 1.12.1 scipy: 0.19.0 xarray: None IPython: 5.1.0 sphinx: 1.4.6 patsy: 0.4.1 dateutil: 2.6.0 pytz: 2017.2 blosc: None bottleneck: 1.2.0 tables: 3.4.2 numexpr: 2.6.2 feather: None matplotlib: 2.0.2 openpyxl: 2.3.2 xlrd: 1.0.0 xlwt: 1.1.2 xlsxwriter: 0.9.3 lxml: 3.6.4 bs4: 4.5.1 html5lib: 0.999999999 sqlalchemy: 1.0.13 pymysql: 0.7.9.None psycopg2: None jinja2: 2.8 s3fs: None pandas_gbq: None pandas_datareader: None
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How to define html id for Pandas Dataframe - python
just use pandas.DataFrame([[1, 2], [3, 4]]).to_html(table_id='hello') you will set table id namely hello.
Read more >pandas.io.formats.style.Styler.set_uuid
Set the uuid applied to id attributes of HTML elements. ... HTML elements within the table, and including the <table> element are assigned...
Read more >Table Visualization — pandas 1.5.2 documentation - PyData |
The DataFrame.style attribute is a property that returns a Styler object. It has a _repr_html_ method defined on it so they are rendered...
Read more >pandas.io.formats.style.Styler — pandas 1.5.2 documentation
Set the DataFrame of strings on Styler generating :hover tooltips. set_uuid (uuid). Set the uuid applied to id attributes of HTML elements.
Read more >pandas.io.formats.style.Styler.set_table_styles
Set the table styles included within the <style> HTML element. ... If supplying a dict, the dict keys should correspond to column names...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
start here: http://pandas.pydata.org/pandas-docs/stable/contributing.html
create a test (e.g. the above), and see it fail. provide a fix, see your test pass.
Submitted pull request for fix for this issue.