Coloring Cells in Pandas

后端 未结 4 1167
耶瑟儿~
耶瑟儿~ 2020-11-28 10:25

I am able to import data from an excel file using Pandas by using:

xl = read_excel(\'path_to_file.xls\', \'Sheet1\', index_col=None, na_values=[\'NA\'])    
         


        
4条回答
  •  一生所求
    2020-11-28 10:49

    try something like this:

    with pandas.io.excel.ExcelWriter(path=Path, engine="xlsxwriter") as writer:
       sheet = writer.book.worksheets()[0]
       sheet.write(x, y, value, format) #format is what determines the color etc.
    

    More info here: https://xlsxwriter.readthedocs.org/format.html

提交回复
热议问题