pandas: HTML output with conditional formatting

后端 未结 2 1606
走了就别回头了
走了就别回头了 2020-12-29 04:18

I am trying to format a table, such that data in each column are formatted in a style depending on their values (similar to conditional formatting in spreadsheet programs).

2条回答
  •  误落风尘
    2020-12-29 04:33

    You can use the DataFrame to_html method, which comes with formatters argument.

    An easier solution would be to surround by and , (rather than *). Note: by default this will be escaped (i.e. < becomes <) so you will need to use the escape=False argument.

提交回复
热议问题