示例#1
0
def groupby(data, field):
    grouped = Odict()
    for record in data.values():
        if int(record["amount"]) > 1 and ("/" not in args[0] or 
            args[0] == get_field(record, "month")):
            value = get_field(record, field)
            current = grouped.get(value, (0, 0))
            grouped[value] = (current[0] + int(record["amount"]), current[1] + 1)
    return grouped
示例#2
0
def groupby(data, field):
    grouped = Odict()
    for record in data.values():
        if int(record["amount"]) > 1 and ("/" not in args[0] or args[0]
                                          == get_field(record, "month")):
            value = get_field(record, field)
            current = grouped.get(value, (0, 0))
            grouped[value] = (current[0] + int(record["amount"]),
                              current[1] + 1)
    return grouped
示例#3
0
 def __init__(self, path, data={}):
     Pdict.__init__(self, path)
     Odict.__init__(self, data)
示例#4
0
 def __init__(self, path, data={}):
     Pdict.__init__(self, path)
     Odict.__init__(self, data)