Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Machine Learning Associate All Questions

View all questions & answers for the Certified Machine Learning Associate exam

Exam Certified Machine Learning Associate topic 1 question 54 discussion

Actual exam question from Databricks's Certified Machine Learning Associate
Question #: 54
Topic #: 1
[All Certified Machine Learning Associate Questions]

A data scientist has a Spark DataFrame spark_df. They want to create a new Spark DataFrame that contains only the rows from spark_df where the value in column discount is less than or equal 0.
Which of the following code blocks will accomplish this task?

  • A. spark_df.loc[:,spark_df["discount"] <= 0]
  • B. spark_df[spark_df["discount"] <= 0]
  • C. spark_df.filter (col("discount") <= 0)
  • D. spark_df.loc(spark_df["discount"] <= 0, :]
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
ricorosol
1 month, 3 weeks ago
C., In PySpark, the typical way to filter rows in a DataFrame is by using the filter method (or its alias, where), combined with a column expression.
upvoted 2 times
...
[Removed]
5 months, 3 weeks ago
Selected Answer: B
This is a duplicate question but both option B and C will give the same result.
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...