cat_sums[cat] += value
TypeError: 'int' object is not iterable
My input is this:
defaultdict(<type 'list'>, {'composed': [0], 'elated': [0], 'unsure': [0], 'hostile': [0], 'tired': [0], 'depressed': [0], 'guilty': [0], 'confused': [0], 'clearheaded': [0], 'anxious': [0], 'confident': [0], 'agreeable': [0], 'energetic': [0]})
And this is assigned to something called catnums
accumulate_by_category(worddict, catnums, categories)
def accumulate_by_category(word_values, cat_sums, cats):
for word, value in word_values.items():
for cat in cats[word]:
cat_sums[cat] += value
Now as far as I can tell, I'm not trying to iterate over an integer. I'm trying to add a value to another value inside catnums.
Is it possible that it is having trouble with the "cats" argument inside my accumulate_by_category() function?
worddict,catnums, andcategoriesto allow others to reproduce your error.