Skip to content

DataFrame.to_html should validate that formatters has the correct length #28469

Closed
@TomAugspurger

Description

@TomAugspurger

The length of formatters should match the number of columns

Both of these should error with a nice message.

In [2]: df = pd.DataFrame(columns=['a', 'b', 'c'])

In [3]: df.to_html(formatters=['{}'.format])


In [4]: df.to_html(formatters=['{}'.format] * 5)

Currntly In [4] succeeds, silently ignoring the bad input. In[3] values with a vague IndexError: list index out of range.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Error ReportingIncorrect or improved errors from pandasIO HTMLread_html, to_html, Styler.apply, Styler.applymapgood first issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions