Python Forum
Spark Problem with Python 3.5 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Spark Problem with Python 3.5 (/thread-13170.html)



Spark Problem with Python 3.5 - AvraHeem - Oct-02-2018

Hello Everyone,

I was watching a video about Spark and then the tutor said that we have to work on Python 3.5 to run error-free code. I download it and configured everything needed to run Spark. Then i tried to run the following piece of code:

flipped = movieCounts.map(lambda(x,y):(y,x))

But unfortunately python interpreter gave me the following error:
Error:
tuple unpacking is not supported in Python 3
The tutor tutorial back to 2015, so it could be that tuple unpacking was not deprecated at that time.

Question: How to tweak the tuple unpacking problem and get the same result? I tried swap function but it pass objects by values not by ref.

Thank you for reading.


RE: Spark Problem with Python 3.5 - snippsat - Oct-02-2018

(Oct-02-2018, 01:27 PM)AvraHeem Wrote: The tutor tutorial back to 2015, so it could be that tuple unpacking was not deprecated at that time.
PEP 3113 -- Removal of Tuple Parameter Unpacking
So similar could be:
flipped = movieCounts.map(lambda x_y: x_y[0] + y_x[1])