title: Pandas: how to format both rows and columns when exporting to Excel (row format takes precedence)?
body: <p>I am using pandas and xlsxwriter to export and format a number of dataframes to Excel.</p>
  
  <p>The xlsxwriter documentation mentions that:
  <a href="http://xlsxwriter.readthedocs.io/worksheet.html?highlight=set_column" rel="nofollow noreferrer">http://xlsxwriter.readthedocs.io/worksheet.html?highlight=set_column</a></p>
  
  <pre><code>A row format takes precedence over a default column format
  </code></pre>
  
  <p><strong>Precedence means that, if you format column B as percentage, and then row 2 as bold, cell B2 won't be bold and in % - it will be bold only, but not in %!</strong></p>
  
  <p>I have provided an example below. <strong>Is there a way around it?</strong> Maybe an engine other than xlsxwriter? Maybe some way to apply formatting after exporting the dataframes to excel?</p>
  
  <p>It makes no difference whether I format the row first and the columns later, or viceversa.</p>
  
  <p>It's not shown in the example below, but in my code I export a number of dataframes, all with the same columns, to the same excel sheet. The dataframes are the equivalent of an Excel Pivot table, with a 'total' row at the bottom. I'd like the header row and the total row to be bold, and each column to have a specific formatting depending on the data (%, thousands, millions, etc). Sample code below.</p>
  
  <p>Thoughts? Thanks!</p>
  
  <pre><code>import pandas as pd
  
  writer = pd.ExcelWriter('test.xlsx')
  wk = writer.book.add_worksheet('Test')
  
  fmt_bold = writer.book.add_format({'bold':True})
  fmt_pct = writer.book.add_format({'num_format': '0.0%'})
  
  wk.write(1,1,1)
  wk.write(2,1,2)
  
  wk.set_column(1,1, None, fmt_pct)
  wk.set_row(1,None, fmt_bold)
  
  writer.close()
  </code></pre>