aggregators

A module with classes for aggregation. An Aggregator has two methods: process and finish.

process(group, val) is called to “add” val to the aggregation of the set of values identified by the value of group. The value in group (which could be any hashable type, also a tuple as (‘A’, ‘B’)) thus corresponds to the GROUP BY attributes in SQL.

finish(group, default) is called to get the final result for group. If no such results exists, default is returned.

class pygrametl.aggregators.Aggregator

Bases: object

finish(group, default=None)
process(group, val)
class pygrametl.aggregators.Avg

Bases: Aggregator

finish(group, default=None)
process(group, val)
class pygrametl.aggregators.Count

Bases: SimpleAggregator

process(group, val)
class pygrametl.aggregators.CountDistinct

Bases: SimpleAggregator

finish(group, default=None)
process(group, val)
class pygrametl.aggregators.Max

Bases: SimpleAggregator

process(group, val)
class pygrametl.aggregators.Min

Bases: SimpleAggregator

process(group, val)
class pygrametl.aggregators.SimpleAggregator

Bases: Aggregator

finish(group, default=None)
process(group, val)
class pygrametl.aggregators.Sum

Bases: SimpleAggregator

process(group, val)