Q:

Get values of dictionary key as list in list of dict without loop

Maybe the title is not clear but let say the input is:
data = [
    {'a':10, 'b': 0, 'c': 2},
    {'a':7, 'b': 4, 'c': 4},
    {'a':4, 'b': 5, 'c': 3}
]

how to get output like this without using loops:
output = {'a': [10, 7, 4], 'b': [0, 4, 5], 'c': [2, 4, 3]}

A:

If you don't want to use loops, you can use pandas which is 3rd party library
import pandas as pd

data = [
    {'a':10, 'b': 0, 'c': 2},
    {'a':7, 'b': 4, 'c': 4},
    {'a':4, 'b': 5, 'c': 3}
]

df = pd.DataFrame(data).to_dict(orient="list")

print(df)

Output:
{'a': [10, 7, 4], 'b': [0, 4, 5], 'c': [2, 4, 3]}

