Skip to content

DataFrame.to_html columns broken #890

Closed
@lodagro

Description

@lodagro

Reported on mailing list, columns argument in DataFrame.to_html() broken.

In [31]: df
Out[31]:
   a         b         c   d
0  4 -0.548572 -0.333272 NaN
1  1 -0.502314  0.975798 NaN
2  9  0.283227  1.486831 NaN
3  3  1.514658 -0.747403 NaN
4  7 -1.415763 -0.697034 NaN

In [32]: print df.to_html(columns=['a'])
<table border="1">
  <thead>
    <tr>
      <th></th>
      <th>a</th>
      <th>b</th>
      <th>c</th>
      <th>d</th>
    </tr>
    </thead>
    <tbody>
    <tr>
      <td><strong>0</strong></td>
      <td> 4</td>
      <td>-0.548572</td>
      <td>-0.333272</td>
      <td>NaN</td>
    </tr>
    <tr>
      <td><strong>1</strong></td>
      <td> 1</td>
      <td>-0.502314</td>
      <td> 0.975798</td>
      <td>NaN</td>
    </tr>
    <tr>
      <td><strong>2</strong></td>
      <td> 9</td>
      <td> 0.283227</td>
      <td> 1.486831</td>
      <td>NaN</td>
    </tr>
    <tr>
      <td><strong>3</strong></td>
      <td> 3</td>
      <td> 1.514658</td>
      <td>-0.747403</td>
      <td>NaN</td>
    </tr>
    <tr>
      <td><strong>4</strong></td>
      <td> 7</td>
      <td>-1.415763</td>
      <td>-0.697034</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions