Re: Error while calculating the max temperature

2014-09-22 Thread Praveen Sripati
Hi Sean, Thanks for the response. I changed from map to flatMap and in the function return a list as below if (temp != "+" and re.match("[01459]", q)): return [(year,temp)] else: return [] Thanks, Praveen On Mon, Sep 22, 2014 at 9:26 PM, Sean Owen wrote: > If your map() sometimes

Re: Error while calculating the max temperature

2014-09-22 Thread Sean Owen
If your map() sometimes does not emit an element, then you need to call flatMap() instead, and emit Some(value) (or any collection of values) if there is an element to return, or None otherwise. On Mon, Sep 22, 2014 at 4:50 PM, Praveen Sripati wrote: > During the map based on some conditions if s

Re: Error while calculating the max temperature

2014-09-22 Thread Praveen Sripati
During the map based on some conditions if some of the rows are ignored (without any transformation) then then there is a record by None in the output RDD for the ignored records. And reduceByKey is not able to handle this type of None record and so the exception. I tried filter, but it is also not

Error while calculating the max temperature

2014-09-22 Thread Praveen Sripati
Hi, I am writing a Spark program in Python to find the maximum temperature for a year, given a weather dataset. The below program throws an error when I try to execute the Spark program. TypeError: 'NoneType' object is not iterable org.apache.spark.api.python.PythonRDD$$anon$1.read(PythonRDD.sc