I am using in-mapper combining in a Map Reduce job via the Python mrjob module. Because I wrote a mapper_final function that emits a single pair, I am sure that only a single key-value pair is emitted to my reducers.
However, my reduce function is erring:
def reducer(self, key, occurrences):
'''
Calculates the final value.
'''
yield 'Final Value: ', occurrences[0] / 2
The error reads
File "calculateFinalValue.py", line 354, in reducer
yield 'Final Value: ', occurrences[0] / 2
TypeError: 'generator' object has no attribute '__getitem__'
Why can I not index into occurrences
? There should only be a single pair in that list, right?