Exam Certified Associate Developer for Apache Spark All QuestionsBrowse all questions from this exam
Question 158

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)

    Correct Answer: D

    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()).

Discussion
azure_bimonsterOption: D

D is right

saryuOption: D

Answer should be D

5effea7Option: D

The answer is D