I got a file that it has lines like this :
Name_of_country,somedata,Max or min degree,degree,other data
so it goes like this :
France,xxx,TMAX,30,....
Germany,xxx,TMIN,40,....
France,xxx,TMIN,10,.....
.
.
.
now i tried this code i have wrote :
from mrjob.job import MRJob
class MRWordFrequencyCount(MRJob):
def mapper(self,_,line):
x=line.split(",")
d={}
if x[2]=="TMAX":
if x[0] not in d.keys() :
d[x[0]]=list(x[3])
else :
d[x[0]]=d[x[0]].append(x[3])
yield d
def reducer(self,d):
for x,y in d.items():
yield x,max(y)
if __name__=='__main__':
MRWordFrequencyCount.run()
now whenever i try to run it using :
!python work.py file.CSV
it gives me this error :
for k, v in mapper(key, value) or ():
ValueError: not enough values to unpack (expected 2, got 1)
which i couldn't understand .. any help ?