Exam Certified Associate Developer for Apache Spark All QuestionsBrowse all questions from this exam
Question 77

Which of the following code blocks returns a DataFrame sorted alphabetically based on column division?

    Correct Answer: A

    To sort a DataFrame alphabetically based on a particular column, in PySpark, you can use the 'sort' function or the 'orderBy' function. The 'sort' function works directly with a column name for ascending order. Therefore, 'storesDF.sort("division")' is the correct choice for sorting the DataFrame alphabetically based on the 'division' column.

Discussion
arturffsiOption: D

Option D works as well

carlosmps

i think so, both works :s

thanabOption: A

A https://spark.apache.org/docs/3.1.2/api/python/reference/api/pyspark.sql.DataFrame.orderBy.html#pyspark.sql.DataFrame.orderBy

azure_bimonsterOption: A

A is good one here

cookiemonster42Option: A

it's A, checked in databricks

zozoshankyOption: C

C is correct

cookiemonster42

we need ascending, not descending, mate