Skip to content
Permalink
Browse files

Backport PR #28216: REGR: <th> tags for notebook display closes #28204 (

  • Loading branch information
meeseeksmachine authored and WillAyd committed Aug 30, 2019
1 parent c44b555 commit 760c65407c3362e3c4660207ea447b90d035f2f5
@@ -62,6 +62,7 @@ Missing
I/O
^^^

- Fix regression in notebook display where <th> tags not used for :attr:`DataFrame.index` (:issue:`28204`).
- Regression in :meth:`~DataFrame.to_csv` where writing a :class:`Series` or :class:`DataFrame` indexed by an :class:`IntervalIndex` would incorrectly raise a ``TypeError`` (:issue:`28210`)
-
-
@@ -679,10 +679,25 @@ def _repr_html_(self):

formatter = fmt.DataFrameFormatter(
self,
columns=None,
col_space=None,
na_rep="NaN",
formatters=None,
float_format=None,
sparsify=None,
justify=None,
index_names=True,
header=True,
index=True,
bold_rows=True,
escape=True,
max_rows=max_rows,
min_rows=min_rows,
max_cols=max_cols,
show_dimensions=show_dimensions,
decimal=".",
table_id=None,
render_links=False,
)
formatter.to_html(notebook=True)
return formatter.buf.getvalue()
@@ -0,0 +1,70 @@
<div>
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>a</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>0</td>
</tr>
<tr>
<th>1</th>
<td>1</td>
</tr>
<tr>
<th>2</th>
<td>2</td>
</tr>
<tr>
<th>3</th>
<td>3</td>
</tr>
<tr>
<th>4</th>
<td>4</td>
</tr>
<tr>
<th>...</th>
<td>...</td>
</tr>
<tr>
<th>56</th>
<td>56</td>
</tr>
<tr>
<th>57</th>
<td>57</td>
</tr>
<tr>
<th>58</th>
<td>58</td>
</tr>
<tr>
<th>59</th>
<td>59</td>
</tr>
<tr>
<th>60</th>
<td>60</td>
</tr>
</tbody>
</table>
<p>61 rows × 1 columns</p>
</div>
@@ -0,0 +1,46 @@
<div>
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>a</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>0</td>
</tr>
<tr>
<th>1</th>
<td>1</td>
</tr>
<tr>
<th>...</th>
<td>...</td>
</tr>
<tr>
<th>59</th>
<td>59</td>
</tr>
<tr>
<th>60</th>
<td>60</td>
</tr>
</tbody>
</table>
<p>61 rows × 1 columns</p>
</div>
@@ -0,0 +1,78 @@
<div>
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>a</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>0</td>
</tr>
<tr>
<th>1</th>
<td>1</td>
</tr>
<tr>
<th>2</th>
<td>2</td>
</tr>
<tr>
<th>3</th>
<td>3</td>
</tr>
<tr>
<th>4</th>
<td>4</td>
</tr>
<tr>
<th>5</th>
<td>5</td>
</tr>
<tr>
<th>...</th>
<td>...</td>
</tr>
<tr>
<th>55</th>
<td>55</td>
</tr>
<tr>
<th>56</th>
<td>56</td>
</tr>
<tr>
<th>57</th>
<td>57</td>
</tr>
<tr>
<th>58</th>
<td>58</td>
</tr>
<tr>
<th>59</th>
<td>59</td>
</tr>
<tr>
<th>60</th>
<td>60</td>
</tr>
</tbody>
</table>
<p>61 rows × 1 columns</p>
</div>

0 comments on commit 760c654

Please sign in to comment.
You can’t perform that action at this time.