Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

EHN: add ability to format index and col names to Styler #57880

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

Merged
merged 20 commits into from
Mar 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update test
  • Loading branch information
quangngd committed Mar 21, 2024
commit 1396cfdda437d5059832ea2d2fc4ad35db940505
65 changes: 2 additions & 63 deletions 65 pandas/tests/io/formats/style/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,66 +1031,5 @@ def test_format_index_names(styler_multi, escape_axis_0, escape_axis_1):
expected_columns = ["A&", "b&"]

result = styler_multi.to_html(table_uuid="test")
expected = f"""\
<style type="text/css">
</style>
<table id="T_test">
<thead>
<tr>
<th class="blank" >&nbsp;</th>
<th class="index_name level0" >{expected_columns[0]}</th>
<th id="T_test_level0_col0" class="col_heading level0 col0" colspan="2">A</th>
<th id="T_test_level0_col2" class="col_heading level0 col2" colspan="2">B</th>
</tr>
<tr>
<th class="blank" >&nbsp;</th>
<th class="index_name level1" >{expected_columns[1]}</th>
<th id="T_test_level1_col0" class="col_heading level1 col0" >a</th>
<th id="T_test_level1_col1" class="col_heading level1 col1" >b</th>
<th id="T_test_level1_col2" class="col_heading level1 col2" >a</th>
<th id="T_test_level1_col3" class="col_heading level1 col3" >b</th>
</tr>
<tr>
<th class="index_name level0" >{expected_index[0]}</th>
<th class="index_name level1" >{expected_index[1]}</th>
<th class="blank col0" >&nbsp;</th>
<th class="blank col1" >&nbsp;</th>
<th class="blank col2" >&nbsp;</th>
<th class="blank col3" >&nbsp;</th>
</tr>
</thead>
<tbody>
<tr>
<th id="T_test_level0_row0" class="row_heading level0 row0" rowspan="2">X</th>
<th id="T_test_level1_row0" class="row_heading level1 row0" >x</th>
<td id="T_test_row0_col0" class="data row0 col0" >0</td>
<td id="T_test_row0_col1" class="data row0 col1" >1</td>
<td id="T_test_row0_col2" class="data row0 col2" >2</td>
<td id="T_test_row0_col3" class="data row0 col3" >3</td>
</tr>
<tr>
<th id="T_test_level1_row1" class="row_heading level1 row1" >y</th>
<td id="T_test_row1_col0" class="data row1 col0" >4</td>
<td id="T_test_row1_col1" class="data row1 col1" >5</td>
<td id="T_test_row1_col2" class="data row1 col2" >6</td>
<td id="T_test_row1_col3" class="data row1 col3" >7</td>
</tr>
<tr>
<th id="T_test_level0_row2" class="row_heading level0 row2" rowspan="2">Y</th>
<th id="T_test_level1_row2" class="row_heading level1 row2" >x</th>
<td id="T_test_row2_col0" class="data row2 col0" >8</td>
<td id="T_test_row2_col1" class="data row2 col1" >9</td>
<td id="T_test_row2_col2" class="data row2 col2" >10</td>
<td id="T_test_row2_col3" class="data row2 col3" >11</td>
</tr>
<tr>
<th id="T_test_level1_row3" class="row_heading level1 row3" >y</th>
<td id="T_test_row3_col0" class="data row3 col0" >12</td>
<td id="T_test_row3_col1" class="data row3 col1" >13</td>
<td id="T_test_row3_col2" class="data row3 col2" >14</td>
<td id="T_test_row3_col3" class="data row3 col3" >15</td>
</tr>
</tbody>
</table>
"""
assert result == expected
for expected_str in expected_index + expected_columns:
assert f"{expected_str}</th>" in result
Morty Proxy This is a proxified and sanitized view of the page, visit original site.