File tree 4 files changed +11
-15
lines changed
4 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ API Changes
73
73
- ``dtypes `` and ``ftypes `` now return a series with ``dtype=object `` on empty containers (:issue: `5740 `)
74
74
- ``df.to_csv `` will now return a string of the CSV data if neither a target path nor a buffer is provided
75
75
(:issue: `6061 `)
76
+ - ``df.to_html `` will now print out the header of an empty dataframe (:issue: `6062 `)
76
77
- The ``interpolate `` ``downcast `` keyword default has been changed from ``infer `` to
77
78
``None ``. This is to preseve the original dtype unless explicitly requested otherwise (:issue: `6290 `).
78
79
- allow a Series to utilize index methods depending on its index type, e.g. ``Series.year `` is now defined
Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ These are out-of-bounds selections
41
41
42
42
- The ``DataFrame.interpolate()`` ``downcast`` keyword default has been changed from ``infer`` to
43
43
``None``. This is to preseve the original dtype unless explicitly requested otherwise (:issue:`6290`).
44
+ - When converting a dataframe to HTML it used to return `Empty DataFrame`. This special case has
45
+ been removed, instead a header with the column names is returned (:issue:`6062`).
44
46
- allow a Series to utilize index methods depending on its index type, e.g. ``Series.year`` is now defined
45
47
for a Series with a ``DatetimeIndex`` or a ``PeriodIndex``; trying this on a non-supported Index type will
46
48
now raise a ``TypeError``. (:issue:`4551`, :issue:`4056`, :issue:`5519`)
Original file line number Diff line number Diff line change @@ -694,17 +694,9 @@ def write_result(self, buf):
694
694
self .write ('<table border="1" class="%s">' % ' ' .join (_classes ),
695
695
indent )
696
696
697
- if len (frame .columns ) == 0 or len (frame .index ) == 0 :
698
- self .write ('<tbody>' , indent + self .indent_delta )
699
- self .write_tr ([repr (frame .index ),
700
- 'Empty %s' % type (frame ).__name__ ],
701
- indent + (2 * self .indent_delta ),
702
- self .indent_delta )
703
- self .write ('</tbody>' , indent + self .indent_delta )
704
- else :
705
- indent += self .indent_delta
706
- indent = self ._write_header (indent )
707
- indent = self ._write_body (indent )
697
+ indent += self .indent_delta
698
+ indent = self ._write_header (indent )
699
+ indent = self ._write_body (indent )
708
700
709
701
self .write ('</table>' , indent )
710
702
if self .fmt .show_dimensions :
Original file line number Diff line number Diff line change @@ -1588,11 +1588,12 @@ def test_to_html_with_classes(self):
1588
1588
expected = dedent ("""
1589
1589
1590
1590
<table border="1" class="dataframe sortable draggable">
1591
- <tbody>
1592
- <tr>
1593
- <td>Index([], dtype='object')</td>
1594
- <td>Empty DataFrame</td>
1591
+ <thead>
1592
+ <tr style="text-align: right;">
1593
+ <th></th>
1595
1594
</tr>
1595
+ </thead>
1596
+ <tbody>
1596
1597
</tbody>
1597
1598
</table>
1598
1599
You can’t perform that action at this time.
0 commit comments