Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

pyspark from_json example

from pyspark.sql.functions import from_json, col
json_schema = spark.read.json(df.rdd.map(lambda row: row.json)).schema
df.withColumn('json', from_json(col('json'), json_schema))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pyspark
ADD COMMENT
Topic
Name
5+1 =