Pandas to Excel conditional formatting whole column

早过忘川 提交于 2019-12-06 13:55:25

First, how can I apply conditional formatting to a whole column

You can specify the cell range from the first to the last row in the column like C1:C1048576. This is how it is stored internally, it is just displayed as C:C.

This applies to all cases where a column range can be used in XlsxWriter.

Second, I want to mark the column B with red if it differs from column C by more than 15%. What would be the correct formula for this?

That is something you should figure out in Excel and then apply the conditional format to XlsxWriter. Something like this will probably work:

=ABS(B1-C1)/C1 > 0.15

Also, I'm running Excel on a Mac, not sure if it makes any difference, but I've noticed where the Windows version uses ,, the Mac version needs ; for formulas. Don't know how this affects xlsxwriter

See the Working with Formulas section of the XlsxWriter docs for an explanation of how to work with this.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!