This works in Python 2.7, but in Python 3.5 it returns
SyntaxError: invalid syntax.
I'm not sure if this has to do with the fact that "tuple unpacking" was removed from Python 3, as I read on another post, or is a different issue.
rddInverted = rdd.map(lambda (x,y): (y,x))
Try something like this:
rddInverted = rdd.map(lambda x: (x[1], x[0]))
I hope it will work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With