I have 2 lists of integers. I want to repeat one list members the times from another list. I tried using zip() function and also my following code, but I get the same error
'TypeError: 'int' object is not callable'
Here is my code -
def predict_from_distribution(distribution, range):
classes = [0, 1, 2, 3, 4, 5]
summation = np.cumsum(distribution)
results = []
uniform_samples = np.random.uniform(0, 1, range)
iterations = np.multiply(distribution, len(uniform_samples))
iterations = [int(num) for num in iterations]
for i in range(len(classes)):
for x in range(iterations[i]):
results.append(classes[i] * x)
return print(results)
predict_from_distribution([0.2, 0.1, 0.25, 0.15, 0.25, 0.05], 50)