Created
December 21, 2021 15:26
-
-
Save 1ambda/884885502a1e36043139ff83089cd6e3 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\ | |
.groupBy("brand", "category_code")\ | |
.agg(countDistinct("product_id").alias("product_count"))\ | |
.show(truncate=False) | |
+------------+--------------------------------------+-------------+ | |
|brand |category_code |product_count| | |
+------------+--------------------------------------+-------------+ | |
|beautix |null |316 | | |
|dr.gloderm |null |31 | | |
|farmona |null |39 | | |
|profhenna |null |56 | | |
|runail |appliances.environment.vacuum |3 | | |
|invisibobble|null |2 | | |
|macadamia |appliances.environment.air_conditioner|1 | | |
|riche |null |58 | | |
|nova |null |1 | | |
|oniq |null |590 | | |
|lebelage |null |45 | | |
|fancy |null |15 | | |
|vilenta |null |20 | | |
|siberina |null |181 | | |
|tertio |null |115 | | |
|jaguar |null |21 | | |
|nitrimax |apparel.glove |21 | | |
|jas |null |16 | | |
|rocknailstar|null |6 | | |
|koreatida |null |3 | | |
+------------+--------------------------------------+-------------+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment