def evaluate(self, data, env):
        """
        Evaluate statement

        Parameters
        ----------
        data : pandas.DataFrame
            Data in whose namespace the statement will be
            evaluated. Typically, this is a group dataframe.

        Returns
        -------
        out : object
            Result of the evaluation.pandas.DataFrame
        """
        def n():
            """
            Return number of rows in groups

            This function is part of the public API
            """
            return len(data)

        if isinstance(self.stmt, str):
            # Add function n() that computes the
            # size of the group data to the inner namespace.
            if self._has_n_func:
                namespace = dict(data, n=n)
            else:
                namespace = data
            # Avoid obvious keywords e.g if a column
            # is named class
            if self.stmt not in KEYWORDS:
                value = env.eval(
                    self.stmt,
                    source_name='Expression.evaluate',
                    inner_namespace=namespace)
            else:
                value = namespace[self.stmt]
        elif callable(self.stmt):
            value = self.stmt(data)
        else:
            value = self.stmt
        return value
Evaluate statement

        Parameters
        ----------
        data : pandas.DataFrame
            Data in whose namespace the statement will be
            evaluated. Typically, this is a group dataframe.

        Returns
        -------
        out : object
            Result of the evaluation.pandas.DataFrame