The code block shown below contains an error. The code block is intended to create a single-column DataFrame from Python list years which is made up of integers. Identify the error.
Code block:
spark.createDataFrame(years, IntegerType)
The code block shown below contains an error. The code block is intended to create a single-column DataFrame from Python list years which is made up of integers. Identify the error.
Code block:
spark.createDataFrame(years, IntegerType)
The IntegerType call must be followed by parentheses. This is because IntegerType is a class, and in Python, for it to be instantiated correctly, the parentheses are required. Therefore, the correct code block should be spark.createDataFrame(years, IntegerType()).
D is right
Answer should be D
The answer is D