def ddply(rows, cols, op=lambda group_rows: group_rows):
    """group rows by cols, then apply the function op to each group 
    rows is list of values or dict with col names (like read from 
    csv.reader or   csv.DictReader)"""

def group_key(row):
    return (row[col] for col in cols)
rows = sorted(rows, key=group_key)
Есть ли реализация ddply Хэдли для python?