I have 2 dictionaries. I want to merge or transpose them together. I've read many posts and still couldn't find exactly what I was looking for; so below is an example.
a is empty, but has all key structures in place.
a = {'id_1': {'Biographic data': {'Name': '',
'Aliases': '',
'Date of birth': '',
'Phone numbers': '',
'Prosecution data': {'Charges': '',
'Case dates': '',
'Verdicts': '',
'Subject information': '',
'Attorney information': '',
'Judge information': '',
'Sentencing information': '',
'Release dates': ''}},
'id_2': {'Biographic data': {'Name': '',
'Aliases': '',
'Date of birth': '',
'Phone numbers': '',
'Prosecution data': {'Charges': '',
'Case dates': '',
'Verdicts': '',
'Subject information': '',
'Attorney information': '',
'Judge information': '',
'Sentencing information': '',
'Release dates': ''}}}
b only has the keys, and its parent keys, for which it has values for.
b = {'id_1': {'Prosecution data': {'Sentencing information': "three-months imprisonment"}},
'id_2': {'Prosecution data': {'Sentencing information': "the death of that person during the period immediately prior to the commission of the offense as established"}}}
I want this (where e.g. id_<x>, Prosecution data, Sentencing information has been appended for both id_1 and id_2):
a = {'id_1': {'Biographic data': {'Name': '',
'Aliases': '',
'Date of birth': '',
'Phone numbers': '',
'Prosecution data': {'Charges': '',
'Case dates': '',
'Verdicts': '',
'Subject information': '',
'Attorney information': '',
'Judge information': '',
'Sentencing information': "three-months imprisonment",
'Release dates': ''}},
'id_2': {'Biographic data': {'Name': '',
'Aliases': '',
'Date of birth': '',
'Phone numbers': '',
'Prosecution data': {'Charges': '',
'Case dates': '',
'Verdicts': '',
'Subject information': '',
'Attorney information': '',
'Judge information': '',
'Sentencing information': "the death of that person during the period immediately prior to the commission of the offense as established",
'Release dates': ''}}}