@@ -297,23 +297,45 @@ public actor DataFrame: Sendable {
297297 return DataFrame ( spark: self . spark, plan: SparkConnectClient . getLimit ( self . plan. root, n) )
298298 }
299299
300+ /// Returns a new ``Dataset`` by sampling a fraction of rows, using a user-supplied seed.
301+ /// - Parameters:
302+ /// - withReplacement: Sample with replacement or not.
303+ /// - fraction: Fraction of rows to generate, range [0.0, 1.0].
304+ /// - seed: Seed for sampling.
305+ /// - Returns: A subset of the records.
300306 public func sample( _ withReplacement: Bool , _ fraction: Double , _ seed: Int64 ) -> DataFrame {
301307 return DataFrame ( spark: self . spark, plan: SparkConnectClient . getSample ( self . plan. root, withReplacement, fraction, seed) )
302308 }
303309
310+ /// Returns a new ``Dataset`` by sampling a fraction of rows, using a random seed.
311+ /// - Parameters:
312+ /// - withReplacement: Sample with replacement or not.
313+ /// - fraction: Fraction of rows to generate, range [0.0, 1.0].
314+ /// - seed: Seed for sampling.
315+ /// - Returns: A subset of the records.
304316 public func sample( _ withReplacement: Bool , _ fraction: Double ) -> DataFrame {
305317 return sample ( withReplacement, fraction, Int64 . random ( in: Int64 . min... Int64 . max) )
306318 }
307319
320+ /// Returns a new ``Dataset`` by sampling a fraction of rows (without replacement), using a
321+ /// user-supplied seed.
322+ /// - Parameters:
323+ /// - fraction: Fraction of rows to generate, range [0.0, 1.0].
324+ /// - seed: Seed for sampling.
325+ /// - Returns: A subset of the records.
308326 public func sample( _ fraction: Double , _ seed: Int64 ) -> DataFrame {
309327 return sample ( false , fraction, seed)
310328 }
311329
330+ /// Returns a new ``Dataset`` by sampling a fraction of rows (without replacement), using a
331+ /// random seed.
332+ /// - Parameters:
333+ /// - fraction: Fraction of rows to generate, range [0.0, 1.0].
334+ /// - Returns: A subset of the records.
312335 public func sample( _ fraction: Double ) -> DataFrame {
313336 return sample ( false , fraction)
314337 }
315338
316-
317339 /// Returns the first `n` rows.
318340 /// - Parameter n: The number of rows. (default: 1)
319341 /// - Returns: ``[[String?]]``
0 commit comments