Created
December 21, 2021 23:29
-
-
Save 1ambda/e26a9320e7fae58985f158c1cb2644e1 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
dfRaw\ | |
.withColumn("product_id", explode(col("product_id_set")))\ | |
.withColumn("category_element", explode(col("category_set")))\ | |
.withColumn("category_code", element_at(col("category_element"), 1))\ | |
.withColumn("category_id", element_at(col("category_element"), 2))\ | |
.select("product_id", "category_code", "category_id")\ | |
.show(truncate=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment