def list_of_dicts_to_dict_of_lists(ld):
    """
    Thanks to Andrew Floren from https://stackoverflow.com/a/33046935/142712
    :param ld: list of dicts
    :return: dict of lists
    """
    return {k: [d[k] for d in ld] for k in ld[0]}