Which of the following code blocks returns the number of rows in DataFrame storesDF for each unique value in column division?
Which of the following code blocks returns the number of rows in DataFrame storesDF for each unique value in column division?
To get the number of rows in a DataFrame for each unique value in a specified column, the correct approach is to use the groupBy function on the desired column and then apply the count function. The code storesDF.groupBy("division").count() correctly groups the rows by the 'division' column and counts the number of rows for each unique value in that column.
E is the right answer here