concept element in category pyspark
appears as: elements, elements, element, element

This is an excerpt from Manning's book Data Analysis with Python and PySpark.
Listing 2.15. Exploding a column of arrays into rows of elements
from pyspark.sql.functions import explode, col words = lines.select(explode(col("line")).alias("word")) words.show(15) # +----------+ # | word| # +----------+ # | The| # | Project| # | Gutenberg| # | EBook| # | of| # | Pride| # | and| # |Prejudice,| # | by| # | Jane| # | Austen| # | | # | This| # | eBook| # | is| # +----------+ # only showing top 15 rows
Figure 8.4. Reducing our RDD by summing the values of the elements.
![]()