Created
December 21, 2021 15:30
-
-
Save 1ambda/eee997a2dc41310c5ee4f380736f53b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df\ | |
.selectExpr("brand", "price")\ | |
.where("brand IS NOT NULL")\ | |
.groupBy("brand")\ | |
.agg(sum("price").alias("sales_price"))\ | |
.orderBy(desc("sales_price"))\ | |
.limit(10)\ | |
.show(truncate=False) | |
+--------+------------------+ | |
|brand |sales_price | | |
+--------+------------------+ | |
|strong |2651513.6799999983| | |
|jessnail|2297451.200000003 | | |
|runail |2108654.9900000114| | |
|irisk |1467889.08999999 | | |
|grattol |1055984.4699999897| | |
|marathon|789238.6300000004 | | |
|masura |693152.7399999842 | | |
|cnd |599136.3200000003 | | |
|uno |546019.0499999991 | | |
|estel |544366.7999999983 | | |
+--------+------------------+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment