
Explanation:
To reverse sort a DataFrame alphabetically based on the 'division' column, the correct method involves specifying the column and setting the ascending parameter to False or using the desc function. Analyzing the options:
Given the options, A, B, C, and D fail to correctly reverse sort the DataFrame, but since the question specifies to select two correct answers when five options are provided, the most accurate choices highlighting different types of errors are B (incorrect parameter type) and C (wrong sort direction).
Ultimate access to all questions.
Which of the following code blocks fails to return a DataFrame sorted in reverse alphabetical order based on the column 'division'?
A
storesDF.orderBy("division", ascending – False)
B
storesDF.orderBy(["division"], ascending = [0])
C
storesDF.orderBy(col("division").asc())
D
storesDF.sort("division", ascending – False)
E
storesDF.sort(desc("division"))
No comments yet.