flatmap python

Do you want to know the information about “flatmap python”. If yes, you’re in the correct tutorial.

flatmap python

array = [[1, 2], [3, 4]]

flatArray = [element for element in innerArray for innerArray in array]
# [1, 2, 3, 4]

rdd2=rdd.flatMap(lambda x: x.split(" "))
for element in rdd2.collect():
    print(element)

data = ["Project Gutenberg’s",
        "Alice’s Adventures in Wonderland",
        "Project Gutenberg’s",
        "Adventures in Wonderland",
        "Project Gutenberg’s"]
rdd=spark.sparkContext.parallelize(data)
for element in rdd.collect():
    print(element)

Final Words

I hope this tutorial helps you to know about “flatmap python”. If you have any queries regarding this post please let us know via the comment section. Share this tutorial with your friends & family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment