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

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

    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
Sowwy1Option: B

B. storesDF.sample(fraction = 0.15)