Exam Certified Associate Developer for Apache Spark All QuestionsBrowse all questions from this 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?

    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
Sowwy1Option: C

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