def select(self, df, args, inplace=False):
        """
        After joining, selects a subset of arguments
        df: the result of a call to self.join(left)
        args: a collcetion of arguments to select, as accepted by drain.util.list_expand:
            - a tuple corresponding to concat_args,
                e.g. [('District', '12h'), ('Distict', '24h')]
            - a dict to be exanded into the above,
                e.g. {'District': ['12h', '24h']}
        """
        if self.prefix is None:
            raise ValueError('Cannot do selection on an Aggregation without a prefix')

        # run list_expand and ensure all args to tuples for validation
        args = [tuple(i) for i in util.list_expand(args)]

        # check that the args passed are valid
        for a in args:
            has_arg = False
            for argument in self.arguments:
                if a == tuple(argument[k] for k in self.concat_args):
                    has_arg = True
                    break
            if not has_arg:
                raise ValueError('Invalid argument for selection: %s' % str(a))

        df = data.select_features(
                df, exclude=[self.prefix + '_.*'],
                include=map(lambda a: self.args_prefix(a) + '.*', args), inplace=inplace)

        return df
def select ( self , df , args , inplace = False ) : if self . prefix is None : raise ValueError ( 'Cannot do selection on an Aggregation without a prefix' ) args = [ tuple ( i ) for i in util . list_expand ( args ) ] for a in args : has_arg = False for argument in self . arguments : if a == tuple ( argument [ k ] for k in self . concat_args ) : has_arg = True break if not has_arg : raise ValueError ( 'Invalid argument for selection: %s' % str ( a ) ) df = data . select_features ( df , exclude = [ self . prefix + '_.*' ] , include = map ( lambda a : self . args_prefix ( a ) + '.*' , args ) , inplace = inplace ) return df
After joining, selects a subset of arguments
        df: the result of a call to self.join(left)
        args: a collcetion of arguments to select, as accepted by drain.util.list_expand:
            - a tuple corresponding to concat_args,
                e.g. [('District', '12h'), ('Distict', '24h')]
            - a dict to be exanded into the above,
                e.g. {'District': ['12h', '24h']}