예제 #1
0
파일: sales.py 프로젝트: digideskio/slbuddy
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)