def _get_mean_uda(self):
        # Dynamically generate the class instance. Use pandas so nulls are
        # excluded
        class Mean(object):

            def __init__(self):
                self.total = 0
                self.count = 0

            def update(self, values):
                values = pd.Series(values)
                self.total += values.sum()
                self.count += values.count()

            def merge(self, other):
                self.total += other.total
                self.count += other.count
                return self

            def finalize(self):
                return self.total / float(self.count)

        return Mean
dataset/ETHPy150Open cloudera/ibis/ibis/tests/test_tasks.py/TestAggregateTasks._get_mean_uda/original