mirror of
https://github.com/donnemartin/system-design-primer.git
synced 2025-12-15 17:38:56 +03:00
Undefined name 'value'... Change to 'values' * 3
The function parameter in __reducer(self, key, value):__ is __value__ (without an _s_) but the function body uses __values__ with an _s_ which creates an undefined name. Solution: change the function parameter from __value__ to __values__.
This commit is contained in:
@@ -35,7 +35,7 @@ class SpendingByCategory(MRJob):
|
|||||||
if period == self.current_year_month():
|
if period == self.current_year_month():
|
||||||
yield (period, category), amount
|
yield (period, category), amount
|
||||||
|
|
||||||
def reducer(self, key, value):
|
def reducer(self, key, values):
|
||||||
"""Sum values for each key.
|
"""Sum values for each key.
|
||||||
|
|
||||||
(2016-01, shopping), 125
|
(2016-01, shopping), 125
|
||||||
|
|||||||
Reference in New Issue
Block a user