Jul-19-2019, 01:16 AM
Just as an FYI I'm still new to working with dicts so the way I have these structured could probably be improved. Basically I have 3 dicts with different information pertaining to individuals contained in each. Each individual has an ID and that is used as the keys. I've tried multiple ways of combining them but each method results in the data being overridden. Also, some ID keys may not be in all of the dicts.
Below are examples of each dict. If anyone has a way of accomplishing this task and/or advice on how to improve the structures I would appreciate it.
Below are examples of each dict. If anyone has a way of accomplishing this task and/or advice on how to improve the structures I would appreciate it.
#alias dict { "10084": { "aliases": { "first_last": "Loren Meyer", "last_first": "Meyer, Loren" } }, "10111": { "aliases": { "first_last": "Cory Higgins", "last_first": "Higgins, Cory" } }, "10163": { "aliases": { "first_last": "Antoine Wright", "last_first": "Wright, Antoine" } } } #vitals dict { "10084": { "vitals": { "ht": 82, "wt": 257, "birth_date": "12/30/1972" } }, "10111": { "vitals": { "ht": 77, "wt": 180, "birth_date": "6/14/1989" } }, "10163": { "vitals": { "ht": 79, "wt": 210, "birth_date": "2/6/1984" } } } #combine dict { "10084": { "combine": { "span": 81.0, "reach": 100.0, "body_fat": 4.1, } }, "10111": { "combine": { "span": 81.0, "reach": 100.0, "body_fat": 9.1, } }, "10163": { "combine": { "span": 75.0, "reach": 85.0, "body_fat": 6.1, } } }