Which of the following code blocks fails to return a DataFrame reverse sorted alphabetically based on column division?
Which of the following code blocks fails to return a DataFrame reverse sorted alphabetically based on column division?
The code block storesDF.orderBy(col("division").asc()) returns a DataFrame sorted in ascending order based on column division, not reverse sorted. Ascending order is the opposite of the required reverse alphabetical sorting.
E is right
C is the answer. Only C will make the data in ascending order. Tested the code.
Option E is right answer
It's C: storesDF.orderBy(col("division").asc()) => storesDF.orderBy(col("division").desc())
Option A and D is giving errors. ~ cannot be used in ascending. Right way is to use ascending=False. Most relevant option is C which is sorting the data in ascending order , Option A, D have some typos it should be = instead of ~.
E. storesDF.sort(desc("division")) Option E correctly uses the desc function to specify the descending order for sorting. Thank you for providing additional information and clarification.
C. It is the only option "not returning" the dataframe in descending(reverse) order. All other formats are returning the descending order. In Oprtion E, if we import the desc function,. it will not throw error and will return the dataframe in descending order.
b i tesetd ut
C is the right answer because it returns the dataframe in ascending order.
C is the correct answer