I am new to python and have looked at other answers on merging dictionaries but was still a bit confused. I am looking to merge together two dictionaries in python by a common value within a specific key to output that common key with the other keys from both dictionaries in a new dictionary.
Here is sample data:
add_sal = {'career_medicine': None, 'career_law': None, 'median_salary': None, 'mean_salary': 75000.0, 'career_business': 'operations / logistics', 'number': None}
add_perc = {'percent': 0.07, 'career_business': 'operations / logistics'}
I would like to merge on the key value pair of 'career_business': 'operations / logistics' and output a dictionary that looks like this:
add_all = {'career_medicine': None, 'career_law': None, 'median_salary': None, 'mean_salary': 75000.0, 'career_business': 'operations / logistics', 'number': None, 'percent': 0.07}
An additional problem is that I do not know if the names will match, and I am looping through a list of add_sal and a list of add_perc.
Any advice would be appreciated! Thank you in advance!