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

The code block shown below should return a 25 percent sample of rows from DataFrame storesDF with reproducible results. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.

Code block:

StoresDF.__1__(__2__ = __3__, __4__ = __5__)

    Correct Answer: C

    To return a 25 percent sample of rows from a DataFrame with reproducible results, you should use the 'sample' method on the DataFrame, set the 'fraction' parameter to 0.25 for a 25% sample, and include a 'seed' parameter with a fixed integer value like 1234 to ensure reproducibility. Therefore, the correct option is: StoresDF.sample(fraction = 0.25, seed = 1234).

Discussion
Sowwy1Option: C

C. 1. sample 2. fraction 3. 0.25 4. seed 5. 1234