Answers for "R sample() funciton in python"

0

R sample() funciton in python

import numpy as np
np.random.choice(values, size=1000,  replace=True, p=probability)

# values is the input values that correspond to the weights
# size is the number of samples to generate
# Replace specifies if it's with or without replacement
# p is the probability of choosing each corresponding value in values
Posted by: Guest on December-03-2020

Python Answers by Framework

Browse Popular Code Answers by Language