1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Spark SQL in Python

Exercise

Split and explode a text column

A dataframe clauses_df with 100 rows is provided. It has a column clause and a row id. Each clause is a string containing one or more words separated by spaces.

Instructions

100 XP
  • Split the clause column into a column called words, containing an array of individual words.
  • Explode the words column into a column called word.
  • Count the resulting number of rows.