'Evaluates patsy expressions within the aesthetics. For example, \'x + 1\'
, \'factor(x)\', or \'pd.cut(price, bins=10)\')'

def _evaluate_expressions(self, data):

    for (key, item) in self.data.items():
        if (item not in data):
            def factor(s, levels=None, labels=None):
                return s.apply(str)
            env = EvalEnvironment.capture(eval_env=(self.__eval_env__ or 1)).with_outer_namespace({u'factor': factor, u'pd': pd, u'np': np})
            try:
                new_val = env.eval(item, inner_namespace=data)
                data[item] = new_val
            except:
                msg = (u"Invalid    column:    '%s'" % str(item))
                matches = difflib.get_close_matches(item, data.columns)
                msg += u'\ndid    you    mean    one    of    the    following:\n'
                for match in matches:
                    msg += (u'                -    %s\n' % match)
                raise Exception(msg)
    return data
