'Set header data'

def headerData(self, section, orientation, role=Qt.DisplayRole):

    if (role != Qt.DisplayRole):
        return to_qvariant()
    if (orientation == Qt.Horizontal):
        if (section == 0):
            return 'Index'
        elif ((section == 1) and PY2):
            try:
                header = to_text_string(self.df_header[0], encoding='utf-8-sig')
            except:
                header = to_text_string(self.df_header[0])
            return to_qvariant(header)
        elif isinstance(self.df_header[(section - 1)], TEXT_TYPES):
            if (not PY2):
                try:
                    header = self.df_header[(section - 1)].encode('utf-8')
                    coding = 'utf-8-sig'
                except:
                    header = self.df_header[(section - 1)].encode('utf-8')
                    coding = encoding.get_coding(header)
            else:
                header = self.df_header[(section - 1)]
                coding = encoding.get_coding(header)
            return to_qvariant(to_text_string(header, encoding=coding))
        else:
            return to_qvariant(to_text_string(self.df_header[(section - 1)]))
    else:
        return to_qvariant()
