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?
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?
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().
C. storesDF.groupBy(“division”, “storeCategory”).count()