Python Forum
Spark Problem with Python 3.5
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spark Problem with Python 3.5
#1
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.
Reply
#2
(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])
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Photo Integration of apache spark and Kafka on eclipse pyspark aupres 1 3,701 Feb-27-2021, 08:38 AM
Last Post: Serafim
  KafkaUtils module not found on spark 3 pyspark aupres 2 7,256 Feb-17-2021, 09:40 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020