I have a list of lists like this:
b = [['r','w'],['n','finished']]
I would like to be able to operate on each element within each list.
I can do this locally in python:
result = b.map(lambda aList: \
map(lambda aString: \
'' if aString.strip().lower() in [' finish', 'finished', 'terminate', 'done'] else aString,\
aList))
But, Spark has trouble serializing the inner map
:
File "/<path>/python/pyspark/worker.py", line 88, in main
12/11/2015 18:24:49 [launcher] command = pickleSer._read_with_length(infile)
12/11/2015 18:24:49 [launcher] File "//<path>/spark/python/pyspark/serializers.py", line 156, in _read_with_length
12/11/2015 18:24:49 [launcher] return self.loads(obj)
12/11/2015 18:24:49 [launcher] File "//<path>//python/pyspark/serializers.py", line 405, in loads
12/11/2015 18:24:49 [launcher] return cPickle.loads(obj)
12/11/2015 18:24:49 [launcher] AttributeError: 'module' object has no attribute 'map'
How do I work around this to either, use an inner map or accomplish the same thing?