Skip to content

Commit 2385c2c

Browse files
author
FelixAbrahamsson
committed
improve: simplify n_target_split
1 parent d7e085f commit 2385c2c

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

datastream/tools/split_dataframes.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,8 @@ def unassigned(keys, split):
144144

145145
def n_target_split(keys, proportion):
146146
float_target_split = len(keys) * proportion
147-
148147
probability = float_target_split - int(float_target_split)
149-
if probability >= 1e-6 and np.random.rand() <= probability:
150-
return int(float_target_split) + 1
151-
else:
152-
return int(float_target_split)
148+
return int(float_target_split) + int(np.random.rand() <= probability)
153149

154150

155151
def selected(k, unassigned):

0 commit comments

Comments
 (0)