def data(self, index, role):
        """
        Get the data for the header.

        This is used when a header has levels.
        """
        if not index.isValid() or \
           index.row() >= self._shape[0] or \
           index.column() >= self._shape[1]:
            return None
        row, col = ((index.row(), index.column()) if self.axis == 0
                    else (index.column(), index.row()))
        if role != Qt.DisplayRole:
            return None
        if self.axis == 0 and self._shape[0] <= 1:
            return None

        header = self.model.header(self.axis, col, row)

        # Don't perform any conversion on strings
        # because it leads to differences between
        # the data present in the dataframe and
        # what is shown by Spyder
        if not is_type_text_string(header):
            header = to_text_string(header)

        return header
def data ( self , index , role ) : if not index . isValid ( ) or index . row ( ) >= self . _shape [ 0 ] or index . column ( ) >= self . _shape [ 1 ] : return None row , col = ( ( index . row ( ) , index . column ( ) ) if self . axis == 0 else ( index . column ( ) , index . row ( ) ) ) if role != Qt . DisplayRole : return None if self . axis == 0 and self . _shape [ 0 ] <= 1 : return None header = self . model . header ( self . axis , col , row ) if not is_type_text_string ( header ) : header = to_text_string ( header ) return header
Get the data for the header.

        This is used when a header has levels.