@docsubst<EOL><INDENT>@stat_1d<EOL>def mean(self, expression, binby=[], limits=None, shape=default_shape, selection=False, delay=False, progress=None, edges=False):<DEDENT>
return self._compute_agg('<STR_LIT>', expression, binby, limits, shape, selection, delay, edges, progress)<EOL>logger.debug("<STR_LIT>", expression, binby, limits, shape, selection, delay)<EOL>expression = _ensure_strings_from_expressions(expression)<EOL>selection = _ensure_strings_from_expressions(selection)<EOL>binby = _ensure_strings_from_expressions(binby)<EOL>@delayed<EOL>def calculate(expression, limits):<EOL><INDENT>task = tasks.TaskStatistic(self, binby, shape, limits, weight=expression, op=tasks.OP_ADD_WEIGHT_MOMENTS_01, selection=selection)<EOL>self.executor.schedule(task)<EOL>progressbar.add_task(task, "<STR_LIT>" % expression)<EOL>return task<EOL><DEDENT>@delayed<EOL>def finish(*stats_args):<EOL><INDENT>stats = np.array(stats_args)<EOL>counts = stats[..., <NUM_LIT:0>]<EOL>with np.errstate(divide='<STR_LIT:ignore>', invalid='<STR_LIT:ignore>'):<EOL><INDENT>mean = stats[..., <NUM_LIT:1>] / counts<EOL><DEDENT>return vaex.utils.unlistify(waslist, mean)<EOL><DEDENT>waslist, [expressions, ] = vaex.utils.listify(expression)<EOL>progressbar = vaex.utils.progressbars(progress)<EOL>limits = self.limits(binby, limits, delay=True)<EOL>stats = [calculate(expression, limits) for expression in expressions]<EOL>var = finish(*stats)<EOL>return self._delay(delay, var)<EOL>
Calculate the mean for expression, possibly on a grid defined by binby.

        Example:

        >>> df.mean("x")
        -0.067131491264005971
        >>> df.mean("(x**2+y**2)**0.5", binby="E", shape=4)
        array([  2.43483742,   4.41840721,   8.26742458,  15.53846476])

        :param expression: {expression}
        :param binby: {binby}
        :param limits: {limits}
        :param shape: {shape}
        :param selection: {selection}
        :param delay: {delay}
        :param progress: {progress}
        :return: {return_stat_scalar}