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

Certified Associate Developer for Apache Spark Exam - Question 77


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

Show Answer
Correct Answer: AD

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

5 comments
Sign in to comment
thanabOption: A
Sep 6, 2023

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

arturffsiOption: D
Mar 11, 2024

Option D works as well

carlosmps
Jun 22, 2024

i think so, both works :s

zozoshankyOption: C
Jul 30, 2023

C is correct

cookiemonster42
Aug 1, 2023

we need ascending, not descending, mate

cookiemonster42Option: A
Aug 1, 2023

it's A, checked in databricks

azure_bimonsterOption: A
Feb 9, 2024

A is good one here