I have a list of dictionaries like the following:
list_dict = [{"hello": [1, 4, 4, 5, 2], "hi":["sjdgf", "sdlkfjsd", "sdfj", "sdfkj", "sdfkjd"], "namaste":[5, 6, 6, 2, 4]}, {"hello": [1, 4, 4, 5, 2], "hi":["sjdgf", "sdlsdfpjsd", "sdfj", "sdfkj", "sdfkjd"], "namaste":[5, 3, 6, 5, 4]}, {"hello": [1, 4, 4, 5, 2], "hi":["sjsdifjgf", "sdlkfjsd", "sdfj", "sdfkj", "sdfkjd"], "namaste":[5, 3, 6, 17, 4]}]
I want to make a final dictionary which simply merges the lists from each of the dictionaries in list_dict
above. The output I am looking for is:
final = {"hello": [1, 4, 4, 5, 2, 1, 4, 4, 5, 2, 1, 4, 4, 5, 2]], "hi":["sjdgf", "sdlkfjsd", "sdfj", "sdfkj", "sdfkjd", "sjdgf", "sdlsdfpjsd", "sdfj", "sdfkj", "sdfkjd", "sjsdifjgf", "sdlkfjsd", "sdfj", "sdfkj", "sdfkjd"], "namaste":[5, 6, 6, 2, 4, 5, 3, 6, 5, 4, 5, 3, 6, 17, 4]}
How can this be done in a scalable way?