We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d57b17b + 54d4891 commit 020c488Copy full SHA for 020c488
Week03/weighted_alp_ozdemir.py
@@ -0,0 +1,8 @@
1
+import random
2
+
3
+def weighted_srs(data,n,weights,with_replacement=False):
4
+ if with_replacement == True and weights != None :
5
+ return random.choices(data,weights=weights,k=n)
6
7
+ return random.sample(data,n,counts=weights)
8
0 commit comments