Skip to content

BUG: Style index name row does not label column class #39716

Closed
@attack68

Description

@attack68
  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


The Styler ignores column class on the index_name row and just inputs blank, which is a pain for controlling table_styles using column selectors.

df3 = pd.DataFrame(0, index=['a'], columns=['A','B'])
df3.index.name = 'foo'
print(df3.style.render())
<style type="text/css">
</style>
<table id="T_a6821_">
  <thead>
    <tr>
      <th class="blank level0" ></th>
      <th class="col_heading level0 col0" >A</th>
      <th class="col_heading level0 col1" >B</th>
    </tr>
    <tr>
      <th class="index_name level0" >foo</th>
      <th class="blank" ></th>
      <th class="blank" ></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th id="T_a6821_level0_row0" class="row_heading level0 row0" >a</th>
      <td id="T_a6821_row0_col0" class="data row0 col0" >0</td>
      <td id="T_a6821_row0_col1" class="data row0 col1" >0</td>
    </tr>
  </tbody>
</table>

Internal mechanics should be fixed to add the col index class.

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