There are two dictionaries
dic_01 = {"name":"aaa","age":29}
dic_02 = {"name":"bbb","age":19}
I want to make a new dictionary like this
dic_03 = {"aaa": 29, "bbb": 19}
How can I do that?
I tried to solve the problem in this way
import pandas as pd
dic_01 = {"name":"aaa","age":29}
dic_02 = {"name":"bbb","age":19}
df = pd.DataFrame([dic_01,dic_02])
dic_03 = {}
for i in range(len(df.index)):
dic_03[df.loc[i,"name"]] = df.loc[i,"age"]
print(dic_03)
Because I have more than two dictionaries to merge into one dictionary, I want to know the better way to solve the question