QuestionQ269

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

Which of the following code blocks returns a 10 percent sample of rows from the DataFrame storesDF, with replacement?

Explanation

DataFrame.sample uses its first argument to specify whether sampling is performed with replacement and its fraction argument to specify the sampling fraction. Setting these to true and 0.1, respectively, produces a 10 percent sample with replacement. PySpark DataFrame.sample documentation

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!