What does df.sort_values(by='x', ascending=False) do?
-
A
Ranks x without reordering rows
-
B
Sorts rows by x, largest first
Correct answer
-
C
Sorts columns by x, largest first
-
D
Drops rows where x is negative
Correct answer
B. Sorts rows by x, largest first
14 views
Explanation
sort_values reorders the rows according to the named column, here from largest to smallest.
Reference
Asked in: NTS, PPSC IT, Interviews
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ