Analogously to:
order_items.groupBy(\"order_item_order_id\").count().orderBy(desc(\"count\")).show()
I have tried:
order_it
You should use aliases for your columns:
import pyspark.sql.functions as func order_items.groupBy("order_item_order_id")\ .agg(func.sum("order_item_subtotal")\ .alias("sum_column_name"))\ .orderBy("sum_column_name")