def select_y(self, order=None, aggregator=None):
        assert self.data is not None
        assert len(self.data) >= 2
        assert self.encoding is not None
        assert self.encoding.x is not None

        if order is None:
            order = ['Q', 'O', 'N', 'T']
        else:
            self._validate_custom_order(order)

        x_name = self.encoding.x.name
        d = self._classify_data_by_type(order, [x_name])

        # Choose the first column found on the following order: Q, O, N, T
        chosen_y = None
        for typ in order:
            if len(d[typ]) >= 1:
                chosen_y = d[typ][0]
                break

        if chosen_y is None:
            raise ValueError('Could not select Y.')

        # Use aggregator if specified
        if aggregator is not None:
            chosen_y = '{}({})'.format(aggregator, chosen_y)

        self.encoding.y = chosen_y
Helper function that does a best effort of selecting an automatic y axis.
dataset/ETHPy150Open ellisonbg/altair/altair/api.py/Viz.select_y