コード例 #1
0
ファイル: datasources.py プロジェクト: harryprince/pygrametl
 def __init__(self, source, rowvaluesatt, colvaluesatt, values,
              aggregator=None, nonevalue=0, sortrows=False):
     """Arguments:
     - source: the data source to pull data from
     - rowvaluesatt: the name of the attribute that holds the values that
       appear as rows in the result
     - colvaluesatt: the name of the attribute that holds the values that
       appear as columns in the result
     - values: the name of the attribute that holds the values to aggregate
     - aggregator: the aggregator to use (see pygrametl.aggregators). If not
       given, pygrametl.aggregators.Sum is used to sum the values
     - nonevalue: the value to return when there is no data to aggregate.
       Default: 0
     - sortrows: A boolean deciding if the rows should be sorted.
       Default: False
     """
     self.__source = source
     self.__rowvaluesatt = rowvaluesatt
     self.__colvaluesatt = colvaluesatt
     self.__values = values
     if aggregator is None:
         from pygrametl.aggregators import Sum
         self.__aggregator = Sum()
     else:
         self.__aggregator = aggregator
     self.__nonevalue = nonevalue
     self.__sortrows = sortrows
     self.__allcolumns = set()
     self.__allrows = set()