'Overriding sort method'

def sort(self, column, order=Qt.AscendingOrder):

    if (self.complex_intran is not None):
        if self.complex_intran.any(axis=0).iloc[(column - 1)]:
            QMessageBox.critical(self.dialog, 'Error', 'TypeError    error:    no    ordering    relation    is    defined    for    complex    numbers')
            return False
    try:
        ascending = (order == Qt.AscendingOrder)
        if (column > 0):
            try:
                self.df.sort_values(by=self.df.columns[(column - 1)], ascending=ascending, inplace=True, kind='mergesort')
            except AttributeError:
                self.df.sort(columns=self.df.columns[(column - 1)], ascending=ascending, inplace=True, kind='mergesort')
            self.update_df_index()
        else:
            self.df.sort_index(inplace=True, ascending=ascending)
            self.update_df_index()
    except TypeError as e:
        QMessageBox.critical(self.dialog, 'Error', ('TypeError    error:    %s' % str(e)))
        return False
    self.reset()
    return True
