[Python] How to change the font color formatting in polars.write_excel()?

Discussão em 'Python' iniciado por Stack, Julho 9, 2025.

  1. Stack

    Stack Membro Participativo

    By default, polars.write_excel() shows negative numbers in red. One can disable this by using the argument

    column_formats={cs.numeric():'General'}


    This works, but what if we need to also customize text color? If I put

    {column: {"font_color": "blue"} for column in df.columns}


    it still puts the negative values in red. Combining the two only applies the last format (depending on order). Is there any way to apply both (meaning having font in blue for some columns, maybe green for others while never mark red the negative numbers)?

    Continue reading...

Compartilhe esta Página