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.
Check your DataFrame with data.columns
It should print something like this
Index([u'regiment', u'company', u'name',u'postTestScore'], dtype='object')
Check for hidden white spaces..Then you can rename with
data = data.rename(columns={'Number ': 'Number'})
I think the column name that contains "Number" is something like " Number" or "Number ". I'm assuming you might have a residual space in the column name. Please run print "<{}>".format(data.columns[1]) and see what you get. If it's something like < Number>, it can be fixed with:
data.columns = data.columns.str.strip()
See pandas.Series.str.strip
In general, AttributeError: 'DataFrame' object has no attribute '...', where ... is some column name, is caused because . notation has been used to reference a nonexistent column name or pandas method.
pandas methods are accessed with a .. pandas columns can also be accessed with a . (e.g. data.col) or with brackets (e.g. ['col'] or [['col1', 'col2']]).
data.columns = data.columns.str.strip() is a fast way to quickly remove leading and trailing spaces from all column names. Otherwise verify the column or attribute is correctly spelled.
The code presented here doesn't show this discrepancy, but sometimes I get stuck when invoking dataframe in all lower case.
Switching to camel-case (pd.DataFrame()) cleans up the problem.
Please check if:
a) you've named a file 'pandas.py' in the same directory as your script, or
b) another variable called 'pd' is used in your program.