code: def headerData(self, section, orientation, role=Qt.DisplayRole):
          
          if role != Qt.DisplayRole:
              return None
  
          if orientation == Qt.Horizontal:
              try:
                  label = self._dataFrame.columns.tolist()[section]
                  if label == section:
                      label = section
                  return label
              except (IndexError, ):
                  return None
          elif orientation == Qt.Vertical:
              return section
docs: Return the header depending on section, orientation and Qt::ItemDataRole
  
          Args:
              section (int): For horizontal headers, the section number corresponds to the column number.
                  Similarly, for vertical headers, the section number corresponds to the row number.
              orientation (Qt::Orientations):
              role (Qt::ItemDataRole):
  
          Returns:
              None if not Qt.DisplayRole
              _dataFrame.columns.tolist()[section] if orientation == Qt.Horizontal
              section if orientation == Qt.Vertical
              None if horizontal orientation and section raises IndexError