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

Exam Certified Associate Developer for Apache Spark All Questions

View all questions & answers for the Certified Associate Developer for Apache Spark exam

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

Which of the following code blocks returns a 15 percent sample of rows from DataFrame storesDF without replacement?

  • A. storesDF.sample(fraction = 0.10)
  • B. storesDF.sampleBy(fraction = 0.15)
  • C. storesDF.sample(True, fraction = 0.10)
  • D. storesDF.sample()
  • E. storesDF.sample(fraction = 0.15)
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
1 year, 7 months ago
Selected Answer: E
The answer is E. Option A returns a 10% sample, not a 15% sample as requested. Option B is incorrect because sampleBy() is used to perform stratified sampling based on a column's values. Option C is incorrect because the first argument should be set to False to prevent sampling with replacement. Option D is incorrect because the sample() method without arguments will return a 50% sample of the DataFrame. Option E is the correct answer as it returns a sample of 15% of the DataFrame without replacement.
upvoted 3 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 ...