Exemplo n.º 1
0
 def rows(self):
     keys = self.data.keys()
     data = self.data
     keys.sort()
     if self.summation:
        sum = {}
        for d in keys:
            datadict = dict(util.mostcommon(data[d]))
            for c in self.columns():
                sum[c] = sum.get(c,0) + datadict.get(c,0)
                datadict[c] = sum[c]
            datadict['DateTime'] = d
            yield datadict
     else:
        for d in keys:
            datadict = dict(util.mostcommon(data[d]))
            datadict['DateTime'] = d
            yield datadict
 def _top(self):
     result = []
     for i in util.mostcommon(self.items()):
         result.append({"elem": i[0], "count": i[1]})
     return result