SESSION: 11( youtube) Apache spark 2- pyspark chain.from_iterable

python

#1

order=sc.textFile(“public/retail_db/orders”)
orders=order.map(lambda x: x.encode(“ascii”, “ignore”).split(","))

order_value=chain.from_iterable(map(lambda x: x.split(","), orders))

ERROR
TypeError: argument 2 to map() must support iteration


#2

#3

Don’t send personal messages. You will not get respond as I am not monitoring the topics on the community closely.

You cannot use chain.from_iterable like this. orders is RDD and chain.from_iterable expects typical Python collection.