From 8e8f78b2ce075a922ecb1b2e8ffa492178dce233 Mon Sep 17 00:00:00 2001 From: cclauss Date: Wed, 14 Mar 2018 13:06:54 +0100 Subject: [PATCH] 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__. --- solutions/system_design/mint/mint_mapreduce.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solutions/system_design/mint/mint_mapreduce.py b/solutions/system_design/mint/mint_mapreduce.py index 2e8339f8..3dc88558 100644 --- a/solutions/system_design/mint/mint_mapreduce.py +++ b/solutions/system_design/mint/mint_mapreduce.py @@ -35,7 +35,7 @@ class SpendingByCategory(MRJob): if period == self.current_year_month(): yield (period, category), amount - def reducer(self, key, value): + def reducer(self, key, values): """Sum values for each key. (2016-01, shopping), 125