: 'function' object has no attribute 'read' on jupyter

Viewed 3503

I'm getting an error uploading a dataset , and it shows an error AttributeError: 'function' object has no attribute 'read' i am on jupyter this is my output 1

1 Answers

The line

spark = SparkSession.builder.master("local").name("test").getOrCreate

assigns the function getOrCreate to the variable spark, which is not what you wanted.

Instead, you want to assign the return value of the function getOrCreate (i.e. a spark session) to the variable spark, so you need to call the function using a pair of empty parentheses:

spark = SparkSession.builder.master("local").name("test").getOrCreate()
Related