getOrCreate is a method on SparkSession.Builder. You need to invoke it by adding the parentheses after:

spark = SparkSession.builder.master("local").appName("Search").config(conf=SparkConf()).getOrCreate()

See for more information: https://spark.apache.org/docs/2.0.1/api/java/org/apache/spark/sql/SparkSession.html

In general, the 'function' object has no attribute error is very common when you are accidentally referencing a function rather than invoking it.

Answer from Chet on Stack Overflow
🌐
Databricks
kb.databricks.com › python › function-object-no-attribute
AttributeError: 'function' object has no attribute
May 19, 2022 - %python df=spark.createDataFrame([1,2], "int").toDF("id") df.show() from pyspark.sql.types import StructType,StructField, StringType, IntegerType df1 = spark.createDataFrame( [(10,), (11,), (13,)], StructType([StructField("summary", IntegerType(), True)])) df1.show() ResultDf = df1.join(df, df1.summary == df.id, "inner").select(df.id,df1.summary) ResultDf.show()
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-fix-attributeerror-object-has-no-attribute
How to fix AttributeError: object has no attribute - GeeksforGeeks
July 23, 2025 - The hasattr() function is a built-in Python function that is used to check whether an object has a particular attribute or method. We have included the "hasattr()" function inside the if-else to add logic to our code snippet. This will avoid the AttributeError: object has no attribute error.
🌐
GitHub
github.com › pandas-dev › pandas › issues › 48733
BUG: AttributeError: 'function' object has no attribute 'currentframe' · Issue #48733 · pandas-dev/pandas
September 23, 2022 - Pandas version checks I have checked that this issue has not already been reported. I have confirmed this bug exists on the latest version of pandas. I have confirmed this bug exists on the main branch of pandas. Reproducible Example imp...
Author   huka81
🌐
Free Python Source Code
freepythonsourcecode.com › post › 109
Attributeerror function object has no attribute python.
September 20, 2024 - The error AttributeError: 'function' object has no attribute Python typically occurs when accessing an attribute or method from a function object, but the function doesn't have that attribute or method.
🌐
Cloudera Community
community.cloudera.com › t5 › Support-Questions › Pyspark-issue-AttributeError-DataFrame-object-has-no › m-p › 78093
Pyspark issue AttributeError: 'DataFrame' object has no attribute 'saveAsTextFile'
January 2, 2024 - Hello community, My first post here, so please let me know if I'm not following protocol. I have written a pyspark.sql query as shown below. I would like the query results to be sent to a textfile but I get the error: AttributeError: 'DataFrame' object has no attribute 'saveAsTextFile' Can ...
🌐
Cumulative Sum
cumsum.wordpress.com › 2020 › 10 › 10 › pyspark-attributeerror-dataframe-object-has-no-attribute-_get_object_id
[pyspark] AttributeError: ‘DataFrame’ object has no attribute ‘_get_object_id’
October 10, 2020 - Consider the following two data frames, and you want to filter df by id with df2: df = spark.createDataFrame([[1, 2, 3], [2, 3, 4], [4, 5, 6]], ['id', 'a', 'b']) df2 = spark.createDataFrame([[1], [2]], ['id']) df.show() +---+---+---+ | id| a| ...
🌐
Python Forum
python-forum.io › thread-36765.html
AttributeError: 'function' object has no attribute 'metadata
Hi! Please help me with the error below. Error: Base.metadata.create_all(engine) AttributeError: 'function' object has no attribute 'metadatarepository -> users.py from Model.Domain.users import Users from sqlalchemy.orm import sessionmaker from ...
Find elsewhere
🌐
Itsourcecode
itsourcecode.com › home › attributeerror: ‘function’ object has no attribute
attributeerror: 'function' object has no attribute [SOLVED]
April 17, 2023 - The “AttributeError: ‘function’ object has no attribute” error occurs when you try to access an attribute or method of an object that doesn’t exist.
🌐
Statology
statology.org › home › how to fix: module ‘pandas’ has no attribute ‘dataframe’
How to Fix: module 'pandas' has no attribute 'dataframe'
October 27, 2021 - import pandas as pd #create a list named 'pd' pd = [1, 2, 3, 4] #attempt to create DataFrame df = pd.dataframe({'points': [25, 12, 15, 14], 'assists': [5, 7, 13, 12]}) AttributeError: module 'pandas' has no attribute 'dataframe'
🌐
Microsoft Learn
learn.microsoft.com › bs-cyrl-ba › azure › databricks › kb › python › function-object-no-attribute
AttributeError: ‘function’ object has no attribute - Databricks
March 11, 2022 - %python df=spark.createDataFrame([1,2], "int").toDF("id") df.show() from pyspark.sql.types import StructType,StructField, StringType, IntegerType df1 = spark.createDataFrame( [(10,), (11,), (13,)], StructType([StructField("summary", IntegerType(), True)])) df1.show() ResultDf = df1.join(df, df1.summary == df.id, "inner").select(df.id,df1.summary) ResultDf.show()
🌐
Cloudxlab
discuss.cloudxlab.com › technical discussions › spark streaming
AttributeError: 'function' object has no attribute '_jrdd' - Spark Streaming - CloudxLab Discussions
December 7, 2018 - I am trying to create a temporary table using Spark Data Frame from the Kafka Streaming data. So that, I can execute query on the table. My code is as follows. from pyspark import SparkConf, SparkContext from pyspark.streaming import StreamingContext from pyspark.streaming.kafka import KafkaUtils ...
🌐
GitHub
github.com › YosefLab › Compass › issues › 92
AttributeError: 'DataFrame' object has no attribute 'iteritems' · Issue #92 · YosefLab/Compass
April 5, 2023 - "Evaluating Reaction Pentalties:" Traceback (most recent call last): File "/home/ubuntu/.local/bin/compass", line 8, in sys.exit(entry()) File "/home/ubuntu/.local/lib/python3.8/site-packages/compass/main.py", line 588, in entry penalties = eval_reaction_penalties(args['data'], args['model'], File "/home/ubuntu/.local/lib/python3.8/site-packages/compass/compass/penalties.py", line 96, in eval_reaction_penalties reaction_penalties = eval_reaction_penalties_shared( File "/home/ubuntu/.local/lib/python3.8/site-packages/compass/compass/penalties.py", line 158, in eval_reaction_penalties_shared for name, expression_data in expression.iteritems(): File "/home/ubuntu/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 5989, in getattr return object.getattribute(self, name) AttributeError: 'DataFrame' object has no attribute 'iteritems'
Author   JoelHaas
🌐
Quora
quora.com › What-does-AttributeError-function-object-has-no-attribute-iterrows-mean
What does AttributeError: 'function' object has no attribute 'iterrows' mean? - Quora
Answer (1 of 2): What it says… You are trying to access an attribute called iterrows but the object in question does not have such attribute, because it is a function, Without seeing the code we can only guess but it seems that you may have forgotten to write a pair of parentheses after the fun...
🌐
Cumulative Sum
cumsum.wordpress.com › 2020 › 04 › 01 › attributeerror-list-object-has-no-attribute-_createfromlocal
AttributeError: ‘list’ object has no attribute ‘_createFromLocal’
April 1, 2020 - df = SparkSession.createDataFrame([(1, ... that SparkSession can’t be directly used to create a data frame, you must create a SparkSession instance first....
🌐
AWS re:Post
repost.aws › questions › QUvWrsRjenSrqHLJqLpy4DWg › attributeerror-dataframe-object-has-no-attribute-get-object-id
AttributeError: 'DataFrame' object has no attribute '_get_object_id' | AWS re:Post
October 11, 2018 - Using the Zeppilin notebook server, I have written the following script. The initialization is taken from the template created in glue, but the rest of it is custom. I'm getting the error: ``` Att...
🌐
Spark By {Examples}
sparkbyexamples.com › home › hbase › attributeerror: ‘dataframe’ object has no attribute ‘map’ in pyspark
AttributeError: 'DataFrame' object has no attribute 'map' in PySpark - Spark By {Examples}
March 27, 2024 - PySpark DataFrame doesn’t have a map() transformation instead it’s present in RDD hence you are getting the error AttributeError: ‘DataFrame’ object has no attribute ‘map’ · So first, Convert PySpark DataFrame to RDD using df.rdd, apply the map() transformation which returns an RDD and Convert RDD to DataFrame back, let’s see with an example. data = [('James',3000),('Anna',4001),('Robert',6200)] df = spark.createDataFrame(data,["name","salary"]) df.show() #converts DataFrame to rdd rdd=df.rdd print(rdd.collect()) # apply map() transformation) rdd2=df.rdd.map(lambda x: [x[0],x[1]*20/100]) print(rdd2.collect()) #conver RDD to DataFrame df2=rdd2.toDF(["name","bonus"]) df2.show()