Python Forum
xlswriter(pandas) and conditional format
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
xlswriter(pandas) and conditional format
#1
Hi,

I'm trying to figure out how to apply the conditional formating on complete specifc colums (J to M here) in an Excel file using Pandas; the only way I've found so fat is to explicitley indicate the range as bellow: what's the right syntax (all my trials failed)?

Thanks

Paul

        worksheet.conditional_format('J1:M1357', {'type':     'cell',
                                                  'criteria': '>',
                                                  'value':     MyVal,
                                                  'format':    MyFormat})  
Reply
#2
Finally I found a workaround ofter diggin on internet using the number "1048576" which seems to be the maximum possible number of lines; not necessarilly elegant but it works as expected

        worksheet.conditional_format('J1:M1048576', {'type':     'cell',
                                                  'criteria': '>',
                                                  'value':     MyVal,
                                                  'format':    MyFormat})  
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pandas keep existing format of Excel AlphaInc 2 879 Jan-11-2024, 03:44 AM
Last Post: plonkarchivist
  Assigning conditional values in Pandas Scott 3 725 Dec-19-2023, 03:10 AM
Last Post: Larz60+
  Pandas: summing columns conditional on the column labels ddd2332 0 2,074 Sep-10-2020, 05:58 PM
Last Post: ddd2332
  Python pandas merge with or conditional Lafayette 0 2,147 May-07-2020, 07:34 PM
Last Post: Lafayette
  Groupby in pandas with conditional - add and subtract rregorr 2 6,917 Jul-12-2019, 05:17 PM
Last Post: rregorr
  Pandas melt only on one variable (leaving other in long format) amyd 0 1,932 May-08-2019, 12:10 PM
Last Post: amyd
  Python pandas remove default format in excel indra 0 2,655 Feb-06-2019, 04:48 AM
Last Post: indra
  Pandas Dataframe conditional actions tom1983 1 2,780 Dec-06-2018, 11:47 PM
Last Post: MAZambelli4353

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020