RDD.
randomSplit
Randomly splits this RDD with the provided weights.
New in version 1.3.0.
weights for splits, will be normalized if they don’t sum to 1
random seed
split RDDs in a list
RDD
See also
pyspark.sql.DataFrame.randomSplit()
Examples
>>> rdd = sc.parallelize(range(500), 1) >>> rdd1, rdd2 = rdd.randomSplit([2, 3], 17) >>> len(rdd1.collect() + rdd2.collect()) 500 >>> 150 < rdd1.count() < 250 True >>> 250 < rdd2.count() < 350 True