Exam Certified Machine Learning Professional All QuestionsBrowse all questions from this exam
Question 7

A data scientist wants to remove the star_rating column from the Delta table at the location path. To do this, they need to load in data and drop the star_rating column.

Which of the following code blocks accomplishes this task?

    Correct Answer: A

    To remove a column from a Delta table, the approach involves loading the table into a DataFrame and then utilizing the drop method to remove the specified column. The correct code snippet accomplishes this by using spark.read.format('delta').load(path).drop('star_rating'), which reads the Delta table at the specified path and drops the 'star_rating' column from the resulting DataFrame.

Discussion
BokNinjaOption: A

A. spark.read.format(“delta”).load(path).drop(“star_rating”)

hugodscarvalhoOption: A

This code reads the Delta table located at path, loads it into a DataFrame, and then drops the "star_rating" column from the DataFrame.

Alishahab70Option: A

A is correct, if it was table_name instead of table_path then D would be correct

sindhu_gowdaOption: A

A is correct

spaceexplorerOption: D

D is correct: https://docs.databricks.com/en/delta/tutorial.html#read-a-table