Skip to content

Commit

Permalink
fix bug with int in weights
Browse files Browse the repository at this point in the history
  • Loading branch information
Davies Liu committed Nov 13, 2014
1 parent 4dfa2cd commit f5fdf63
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/pyspark/rdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,13 @@ def randomSplit(self, weights, seed=None):
:return: split RDDs in a list
>>> rdd = sc.parallelize(range(5), 1)
>>> rdd1, rdd2 = rdd.randomSplit([2.0, 3.0], 101)
>>> rdd1, rdd2 = rdd.randomSplit([2, 3], 101)
>>> rdd1.collect()
[2, 3]
>>> rdd2.collect()
[0, 1, 4]
"""
s = sum(weights)
s = float(sum(weights))
cweights = [0.0]
for w in weights:
cweights.append(cweights[-1] + w / s)
Expand Down

0 comments on commit f5fdf63

Please sign in to comment.