Reputation: 21
When I perform the following actions.I met this problem in centos 7.0 and spark 2.1.0. I am a freshman in spark. How to fix it?
>>> from pyspark.sql import SQLContext
>>> ssc = SQLContext(sc)
>>> df = ssc.jsonFile('file:///root/work/person.json')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'SQLContext' object has no attribute 'jsonFile'
Upvotes: 2
Views: 4107
Reputation: 51
jsonFile has been deprecated, please use sqlContext.read.json
Upvotes: 0
Reputation: 23109
Use SparkSession
with the newer version of Spark and read using
df = spark.read.json('path to json)
.
Upvotes: 2