Skip to content

Instantly share code, notes, and snippets.

@1ambda
Created December 21, 2021 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1ambda/25a1efd03b411d1836be705ae708f42c to your computer and use it in GitHub Desktop.
Save 1ambda/25a1efd03b411d1836be705ae708f42c to your computer and use it in GitHub Desktop.
dfRecovered = dfCategory\
.withColumn("category_id", get_json_object(col("category"), "$.category_id"))\
.withColumn("category_code", get_json_object(col("category"), "$.category_code"))
dfRecovered.printSchema()
dfRecovered.show(truncate=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment