def rows2columns(rows):
    """Convert [{key: value}, {key: value2}] to [{key: [value, value2]}]
    """
    if not len(rows):
        return {}

    cols_combinations = set(tuple(sorted(row.columns)) for row in rows)

    if len(cols_combinations) > 1:
        raise KeyError('All rows should have the same columns, got: '
                       '{}'.format(cols_combinations))

    columns = rows[0].columns

    return {col: [row[col] for row in rows] for col in columns}