Answers for "pyspark read json to dataframe"

1

pyspark dataframe json string

newJson = '{"Name":"something","Url":"https://stackoverflow.com","Author":"jangcy","BlogEntries":100,"Caller":"jangcy"}'
df = spark.read.json(sc.parallelize([newJson]))
df.show(truncate=False)
Posted by: Guest on June-25-2020
0

Read JSON files with automatic schema inference

# Read JSON files with automatic schema inference

df = spark.read.json("logs.json")
df.where("age > 21").select("name.first").show()
Posted by: Guest on April-12-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language