I'm constantly having this error and I do not know how to fix it.
This is the code:
import numpy as np
import itertools
import random
g_row=10
g_col=10
m_prob = np.ones((g_row, g_col), dtype=np.int)
s_acomulada = list(itertools.accumulate(itertools.chain.from_iterable(m_prob)))
papeletas = np.ones((g_row, g_col), dtype=np.int)
for i, fila in enumerate(s_acomulada):
for j, n in enumerate(fila):
papeletas[i][j] = tuple(range(inicio, inicio+n))
inicio += n
print(papeletas)
And when you execute it, it returns this:
TypeError: 'numpy.int32' object is not iterable
I would also like m_prob, s_computed and ballots to be the three 10x10 matrices, as m_prob, if possible.
Greetings, thank you.