Certified Associate Developer for Apache Spark Exam QuestionsBrowse all questions from this exam

Certified Associate Developer for Apache Spark Exam - Question 100


Which of the following code blocks returns the number of rows in DataFrame storesDF for each distinct combination of values in column division and column storeCategory?

Show Answer
Correct Answer: C

To return the number of rows in DataFrame storesDF for each distinct combination of values in columns division and storeCategory, you can use the groupBy method with both column names as arguments followed by the count function. This groups the DataFrame by the specified columns and then counts the number of rows in each group. The correct code block is storesDF.groupBy(“division”, “storeCategory”).count().

Discussion

1 comment
Sign in to comment
Sowwy1Option: C
Apr 1, 2024

C. storesDF.groupBy(“division”, “storeCategory”).count()