def group_results(df, group_by, category):
    """Creates groups of rows grouped by group_by (for example image_id)"""
    print("Grouping results by {}".format(group_by))
    grouped = df.groupby(group_by)[category]

    return grouped