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 @@ -74,6 +74,7 @@ API Changes
74
74
- ``dtypes `` and ``ftypes `` now return a series with ``dtype=object `` on empty containers (:issue: `5740 `)
75
75
- ``df.to_csv `` will now return a string of the CSV data if neither a target path nor a buffer is provided
76
76
(:issue: `6061 `)
77
+ - ``df.to_html `` will now print out the header of an empty dataframe (:issue: `6062 `)
77
78
- The ``interpolate `` ``downcast `` keyword default has been changed from ``infer `` to
78
79
``None ``. This is to preseve the original dtype unless explicitly requested otherwise (:issue: `6290 `).
79
80
- 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 @@ -42,6 +42,8 @@ These are out-of-bounds selections
42
42
43
43
- The ``DataFrame.interpolate()`` ``downcast`` keyword default has been changed from ``infer`` to
44
44
``None``. This is to preseve the original dtype unless explicitly requested otherwise (:issue:`6290`).
45
+ - When converting a dataframe to HTML it used to return `Empty DataFrame`. This special case has
46
+ been removed, instead a header with the column names is returned (:issue:`6062`).
45
47
- allow a Series to utilize index methods depending on its index type, e.g. ``Series.year`` is now defined
46
48
for a Series with a ``DatetimeIndex`` or a ``PeriodIndex``; trying this on a non-supported Index type will
47
49
now raise a ``TypeError``. (:issue:`4551`, :issue:`4056`, :issue:`5519`)
Original file line number Diff line number Diff line change @@ -712,17 +712,9 @@ def write_result(self, buf):
712
712
self .write ('<table border="1" class="%s">' % ' ' .join (_classes ),
713
713
indent )
714
714
715
- if len (frame .columns ) == 0 or len (frame .index ) == 0 :
716
- self .write ('<tbody>' , indent + self .indent_delta )
717
- self .write_tr ([repr (frame .index ),
718
- 'Empty %s' % type (frame ).__name__ ],
719
- indent + (2 * self .indent_delta ),
720
- self .indent_delta )
721
- self .write ('</tbody>' , indent + self .indent_delta )
722
- else :
723
- indent += self .indent_delta
724
- indent = self ._write_header (indent )
725
- indent = self ._write_body (indent )
715
+ indent += self .indent_delta
716
+ indent = self ._write_header (indent )
717
+ indent = self ._write_body (indent )
726
718
727
719
self .write ('</table>' , indent )
728
720
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