Exit DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK Databricks Certified Associate Developer for Apache Spark 3.0
Question 1 of 5
0% complete
Q1 Single choice

The code block displayed below contains an error. The code block should use Python method find_most_freq_letter to find the letter present most in column itemName of DataFrame itemsDf and return it in a new column most_frequent_letter. Find the error.

Code block:
1. find_most_freq_letter_udf = udf(find_most_freq_letter)

2. itemsDf.withColumn("most_frequent_letter", find_most_freq_letter("itemName"))

  • A

    Spark is not using the UDF method correctly.

  • B

    The UDF method is not registered correctly, since the return type is missing.

  • C

    The "itemName" expression should be wrapped in col().

  • D

    UDFs do not exist in PySpark.

  • E

    Spark is not adding a column.

Previous Next