This repository was archived by the owner on Apr 1, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ def render_html(
3535 table_id : str ,
3636) -> str :
3737 """Render a pandas DataFrame to HTML with specific styling."""
38- classes = "table table-striped table-hover"
38+ classes = "dataframe table table-striped table-hover"
3939 table_html = [f'<table border="1" class="{ classes } " id="{ table_id } ">' ]
4040 precision = options .display .precision
4141
@@ -50,14 +50,16 @@ def render_html(
5050 table_html .append (" </thead>" )
5151
5252 # Render table body
53- table_html .append (' <tbody style="padding: 0.5em;">' )
53+ table_html .append (" <tbody>" )
5454 for i in range (len (dataframe )):
5555 table_html .append (" <tr>" )
5656 row = dataframe .iloc [i ]
5757 for col_name , value in row .items ():
5858 dtype = dataframe .dtypes .loc [col_name ] # type: ignore
5959 align = "right" if _is_dtype_numeric (dtype ) else "left"
60- table_html .append (' <td style="text-align: {};">' .format (align ))
60+ table_html .append (
61+ ' <td style="text-align: {}; padding: 0.5em;">' .format (align )
62+ )
6163
6264 # TODO(b/438181139): Consider semi-exploding ARRAY/STRUCT columns
6365 # into multiple rows/columns like the BQ UI does.
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ def test_render_html_alignment_and_precision(
132132
133133 for _ , align in expected_alignments .items ():
134134 assert 'th style="text-align: left;"' in html
135- assert f'<td style="text-align: { align } ;"> ' in html
135+ assert f'<td style="text-align: { align } ;' in html
136136
137137 for expected_string in expected_strings :
138138 assert expected_string in html
You can’t perform that action at this time.
0 commit comments