(self, attr, filter_valid=True,
                   max_categories=None, return_labels=False)
Retrieve the data from the given column in the data table

        The method:
        - densifies sparse data,
        - converts arrays with dtype object to floats if the attribute is
          actually primitive,
        - filters out invalid data (if `filter_valid` is `True`),
        - merges infrequent (discrete) values into a single value
          (if `max_categories` is set).

        Tha latter feature is used for shapes and labels, where only a
        specified number of different values is shown, and others are
        merged into category 'Other'. In this case, the method may return
        either the data (e.g. color indices, shape indices) or the list
        of retained values, followed by `['Other']`.

        Args:
            attr (:obj:~Orange.data.Variable): the column to extract
            filter_valid (bool): filter out invalid data (default: `True`)
            max_categories (int): merge infrequent values (default: `None`);
                ignored for non-discrete attributes
            return_labels (bool): return a list of labels instead of data
                (default: `False`)

        Returns:
            (np.ndarray): (valid) data from the column, or a list of labels
Retrieve the data from the given column in the data table
Retrieve the data from the given column in the data table
def get_column(self, attr, filter_valid=True,
                   max_categories=None, return_labels=False):
        """
        Retrieve the data from the given column in the data table

        The method:
        - densifies sparse data,
        - converts arrays with dtype object to floats if the attribute is
          actually primitive,
        - filters out invalid data (if `filter_valid` is `True`),
        - merges infrequent (discrete) values into a single value
          (if `max_categories` is set).

        Tha latter feature is used for shapes and labels, where only a
        specified number of different values is shown, and others are
        merged into category 'Other'. In this case, the method may return
        either the data (e.g. color indices, shape indices) or the list
        of retained values, followed by `['Other']`.

        Args:
            attr (:obj:~Orange.data.Variable): the column to extract
            filter_valid (bool): filter out invalid data (default: `True`)
            max_categories (int): merge infrequent values (default: `None`);
                ignored for non-discrete attributes
            return_labels (bool): return a list of labels instead of data
                (default: `False`)

        Returns:
            (np.ndarray): (valid) data from the column, or a list of labels
        """
        if attr is None:
            return None

        needs_merging = attr.is_discrete \
                        and max_categories is not None \
                        and len(attr.values) >= max_categories
        if return_labels and not needs_merging:
            assert attr.is_discrete
            return attr.values

        all_data = self.data.get_column_view(attr)[0]
        if all_data.dtype == object and attr.is_primitive():
            all_data = all_data.astype(float)
        if filter_valid and self.valid_data is not None:
            all_data = all_data[self.valid_data]
        if not needs_merging:
            return all_data

        dist = bincount(all_data, max_val=len(attr.values) - 1)[0]
        infrequent = np.zeros(len(attr.values), dtype=bool)
        infrequent[np.argsort(dist)[:-(max_categories-1)]] = True
        if return_labels:
            return [value for value, infreq in zip(attr.values, infrequent)
                    if not infreq] + ["Other"]
        else:
            result = all_data.copy()
            freq_vals = [i for i, f in enumerate(infrequent) if not f]
            for i, infreq in enumerate(infrequent):
                if infreq:
                    result[all_data == i] = max_categories - 1
                else:
                    result[all_data == i] = freq_vals.index(i)
            return result
def get_column ( self , attr , filter_valid = True , max_categories = None , return_labels = False ) : if attr is None : return None needs_merging = attr . is_discrete and max_categories is not None and len ( attr . values ) >= max_categories if return_labels and not needs_merging : assert attr . is_discrete return attr . values all_data = self . data . get_column_view ( attr ) [ 0 ] if all_data . dtype == object and attr . is_primitive ( ) : all_data = all_data . astype ( float ) if filter_valid and self . valid_data is not None : all_data = all_data [ self . valid_data ] if not needs_merging : return all_data dist = bincount ( all_data , max_val = len ( attr . values ) - 1 ) [ 0 ] infrequent = np . zeros ( len ( attr . values ) , dtype = bool ) infrequent [ np . argsort ( dist ) [ : - ( max_categories - 1 ) ] ] = True if return_labels : return [ value for value , infreq in zip ( attr . values , infrequent ) if not infreq ] + [ "Other" ] else : result = all_data . copy ( ) freq_vals = [ i for i , f in enumerate ( infrequent ) if not f ] for i , infreq in enumerate ( infrequent ) : if infreq : result [ all_data == i ] = max_categories - 1 else : result [ all_data == i ] = freq_vals . index ( i ) return result