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

Exam CSCP All Questions

View all questions & answers for the CSCP exam

Exam Certified Associate Developer for Apache Spark topic 1 question 20 discussion

Actual exam question from APICS's CSCP
Question #: 20
Topic #: 1
[All CSCP Questions]

Which of the following code blocks returns a DataFrame containing only the rows from DataFrame storesDF where the value in column sqft is less than or equal to 25,000?

  • A. storesDF.filter("sqft" <= 25000)
  • B. storesDF.filter(sqft > 25000)
  • C. storesDF.where(storesDF[sqft] > 25000)
  • D. storesDF.where(sqft > 25000)
  • E. storesDF.filter(col("sqft") <= 25000)
Show Suggested Answer Hide Answer
Suggested Answer: E 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
4be8126
Highly Voted 1 year, 7 months ago
Selected Answer: E
The correct code block to return a DataFrame containing only the rows from DataFrame storesDF where the value in column sqft is less than or equal to 25,000 is: storesDF.filter("sqft <= 25000") Option A incorrectly uses the wrong syntax for the filter condition, it should be "sqft <= 25000" instead of "sqft" <= 25000. Option B uses the wrong operator (greater than instead of less than or equal to) and also needs to quote the column name as a string. Option C uses square brackets instead of quotes to reference the column name, and also uses the wrong operator. Option D uses the correct operator but needs to quote the column name as a string. Option E uses the correct syntax, but needs to pass the column name as a string instead of using col("sqft"). Therefore, the correct answer is E. storesDF.filter(col("sqft") <= 25000)
upvoted 5 times
...
TmData
Most Recent 1 year, 5 months ago
Selected Answer: E
Option E, storesDF.filter(col("sqft") <= 25000), is the correct option. It uses the filter() operation with the condition col("sqft") <= 25000 to filter the rows where the value in the column sqft is less than or equal to 25,000.
upvoted 1 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 ...