How can I change all the letters A to a 9 and all the letters B to an 8 in an RDD with a lambda function. I tried this but it does not work:
rdd.map(lambda a: 9 if a == "A" else a == a)
rdd.map(lambda a: 8 if a == 'B' else a == a)
My example rdd:
[[u'55', u'A', u'433235', u'12', u'09'], [u'2017', u'B', u'24212', u'4', u'1']]
And I would have to go to:
[[u'55', u'9', u'433235', u'12', u'09'], [u'2017', u'8', u'24212', u'4', u'1']]
Thanks in advance for your generous help.