
Answer-first summary for fast verification
Answer: `fixed_price_df.filter(col("price") > 0)`
In Databricks, the `filter` method combined with a column expression is used to filter a DataFrame based on a specific condition. The correct syntax is `fixed_price_df.filter(col("price") > 0)`, which filters the DataFrame to include only rows where the `price` column value is greater than 0.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
Which code snippet correctly filters a DataFrame named fixed_price_df in Databricks to only include rows where the price column value is greater than 0?
A
fixed_price_df.contains(col("price") > 0)
B
fixed_price_df.filter(col("price") > 0)
C
fixed_price_df.where("price" > 0)
D
fixed_price_df.filter("price" > 0)
E
None of the above
No comments yet.