how to color selected columns in python dataframe?

前端 未结 2 642

I am using the below code to export my df to excel, I have a requirement to color the particular columns in the output excel.

# DF TO EXCEL
from pandas import Ex         


        
2条回答
  •  耶瑟儿~
    2021-01-21 13:43

    A little update for those that would find this question; today Pandas is including style functions and styler objects, and this is extremely practical to achieve what you want without going through very convoluted methods. https://pandas.pydata.org/pandas-docs/stable/style.html

提交回复
热议问题