title: Set background color of QtTableWidget cell based on dataframe result condition
body: <p>I'm attempting to change the background color of a cell after a specific condition is met in a PyQt5 UI that will be displaying SQL results in a pandas dataframe. My assumption is the condition would need to be set within the QtTableWidget in the process of taking the dataframe results and pasting them into the window, and not through the dataframe.style.apply function. Here is my code at the moment. UI loads successfully, but once I try to load the results, it crashes (does not happen if I'm not putting in this code, and I've learned this means a part of the code is not working).</p>
  
  <p>I've attached a photo of the UI working with results showing. Main goal is to highlight the 'Y' under "In Production" green, and red if 'N'. Can be applied for other columns as well.</p>
  
  <pre class="lang-py prettyprint-override"><code>def print_output(self):
      file1 = self.result_query()
      file1 = file1[['in production',
                     'rows (prod)',
                     'expected row count',
                     'row check',
                     'export name',
                     'export group',
                     'export id',
                     'export status',
                     'prod export timestamp',
                     'holiday check',
                     'in test',
                     'rows (test)',
                     'test export timestamp',
                     'fixing flag',
                     'export type',
                     'filepath',
                     'synced to production']]
      self.ExportStatusWindow.setColumnCount(len(file1.columns))
      self.ExportStatusWindow.setRowCount(len(file1.index))
      self.ExportStatusWindow.setHorizontalHeaderLabels(file1.columns.str.title())
         for i in range(len(file1.index)):
              for j in range(len(file1.columns)):
                   #where it's posting dataframe results to view
                   self.ExportStatusWindow.setItem(i, j, QtWidgets.QTableWidgetItem(str(file1.iat[i, j])))
                   #where i'm attempting to change cell color with condition
                   if self.ExportStatusWindow.HorizontalHeaderLabels(file1.columns.str.title('in production')) == 'Y':
                     self.ExportStatusWindow(rowIndex, j).setBackground(QtGui.QColor(green))
                   else:
                     self.ExportStatusWindow(rowIndex, j).setBackground(QtGui.QColor(red))
      self.ExportStatusWindow.horizontalHeader().setStretchLastSection(False)
      self.ExportStatusWindow.resizeColumnsToContents()
      self.ExportStatusWindow.resizeRowsToContents()
      self.ExportStatusWindow.horizontalHeader().setStretchLastSection(True)
  </code></pre>
  
  <p>Example of working UI with results</p>
  
  <p><img src="https://i.stack.imgur.com/skVMw.png" alt="Example of working UI with results"></p>