Certified Machine Learning Professional Exam QuestionsBrowse all questions from this exam

Certified Machine Learning Professional 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?

Show Answer
Correct Answer: AD

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

5 comments
Sign in to comment
BokNinjaOption: A
Dec 19, 2023

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

hugodscarvalhoOption: A
Jan 27, 2024

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
Feb 7, 2024

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

spaceexplorerOption: D
Feb 1, 2024

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

sindhu_gowdaOption: A
Jun 11, 2024

A is correct