Вы можете использовать np.unravel_index
, чтобы получить все цифры сразу:
>>> import numpy as np
>>> from pprint import pprint
>>>
>>> a = np.random.randint(0, 1000, (12,))
### put as many 10s here as there are decimal places
### vvvv
>>> digits = np.unravel_index(a, (10, 10, 10))
>>>
>>> a
array([724, 403, 334, 691, 810, 559, 634, 916, 17, 915, 375, 37])
>>> pprint(digits)
(array([7, 4, 3, 6, 8, 5, 6, 9, 0, 9, 3, 0]),
array([2, 0, 3, 9, 1, 5, 3, 1, 1, 1, 7, 3]),
array([4, 3, 4, 1, 0, 9, 4, 6, 7, 5, 5, 7]))