QuestionQ296

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

Which of the following code blocks returns the row count in DataFrame storesDF for every distinct combination of values in the division and storeCategory columns?

Explanation

Spark's Scala Dataset.groupBy(col1: String, cols: String*) overload groups a DataFrame by the specified existing column names. Supplying "division" and "storeCategory" forms groups for each distinct pair of those values, and count() produces the number of rows in each group.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!