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

Certified Associate Developer for Apache Spark 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)

Show Answer
Correct Answer: B,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

3 comments
Sign in to comment
azure_bimonsterOption: D
Feb 9, 2024

D is right

saryuOption: D
Feb 2, 2024

Answer should be D

5effea7Option: D
Jul 12, 2024

The answer is D