I want a dictionary that shows boolean counts. I.e. how often name/position combination meets criteria. E.g.:
Key - Value1 - Value2
John12 Yes:300 No:25
John13 Yes:400 No:29
Linda13 Yes:300 No:60
...
I tried this:
if str(f[1]) + str(f[7]) in psHpGrp:
if f[6] == 1:
psHpGrp.setdefault(str(f[1]) + str(f[7]), []) +=1
And because of a bug I got "SyntaxError: illegal expression for augmented assignment"
So googling gave me this:
if str(f[1]) + str(f[7]) in psHpGrp:
if f[6] == 1:
i = psHpGrp.setdefault((f[1]) + str(f[7]), [])
i += 1
else:
j = psHpGrp.setdefault((f[1]) + str(f[7]), [])
j += 1
else:
psHpGrp.setdefault(str(f[1]) + str(f[7]), []).append(str(f[1]) + str(f[7]))
And now I get: j += 1 'int' object is not iterable
Whats wrong here?