Certified Associate Developer for Apache Spark Exam QuestionsBrowse all questions from this exam

Certified Associate Developer for Apache Spark Exam - Question 138


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

Show Answer
Correct Answer: B

To obtain a 15 percent sample of rows from a DataFrame without replacement, the correct method is `sample(fraction = 0.15)`. This function will return a DataFrame containing approximately 15% of the rows from the original DataFrame. The parameter `fraction` specifies the proportion of the DataFrame to sample, and by default, sampling is done without replacement.

Discussion

1 comment
Sign in to comment
Sowwy1Option: B
Apr 10, 2024

B. storesDF.sample(fraction = 0.15)