Jul-22-2023, 08:04 PM
Greetings! I am new to this group and apologize in advance if I'm not asking for help properly.
I'm trying to figure out this error:
TypeError: unsupported operand type(s) for -: 'int' and 'list'
For this part of the code:
i = 0.0
for field in val_group_fields:
mprop = [float(sumdict[field]) / (float(sumdict["Total"]))]
i+= mprop * (1 - mprop)
sumdict[field] = [sumdict[field], mprop]
The error happens because of the + and – operators for the mprop list. It looks like mprop is either an integer or list and they cannot be added or subtracted together. I think I have to change them to work, but I can’t figure out how to do that. Please assist. Thank you!
I'm trying to figure out this error:
TypeError: unsupported operand type(s) for -: 'int' and 'list'
For this part of the code:
i = 0.0
for field in val_group_fields:
mprop = [float(sumdict[field]) / (float(sumdict["Total"]))]
i+= mprop * (1 - mprop)
sumdict[field] = [sumdict[field], mprop]
The error happens because of the + and – operators for the mprop list. It looks like mprop is either an integer or list and they cannot be added or subtracted together. I think I have to change them to work, but I can’t figure out how to do that. Please assist. Thank you!