So im trying to get 2 lists with the infected and detected. results (almost always) contains False and could contain True. im getting a keyerror with this code. Maybe a try..catch but what if either infection or detection is empty?
results = {'infected': {False: 39}, 'detection': {False: 39}}
infectedDetected = [results['infected'][True],
results['detection'][True]]
notinfectedDetected = [results['infected'][False],
results['detection'][False]]
Example of the preferred output:
infectedDetected = [0, 0]
notinfectedDetected = [39, 39]
What i've tried:
infectedDetected = [results['infected'][True] if not Keyerror else 0,
results['detection'][True] if results['detection'][True] != KeyError else 0]
notinfectedDetected = [results['infected'][False],
results['detection'][False]]