Which of the following code blocks returns a DataFrame sorted alphabetically based on column division?
Which of the following code blocks returns a DataFrame sorted alphabetically based on column division?
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.
Option D works as well
i think so, both works :s
A https://spark.apache.org/docs/3.1.2/api/python/reference/api/pyspark.sql.DataFrame.orderBy.html#pyspark.sql.DataFrame.orderBy
A is good one here
it's A, checked in databricks
C is correct
we need ascending, not descending, mate