import numpy as np, numba as nb
@nb.njit
def f(a):
for i in range(len(a)):
# a[i] = (i, i+1) works with Python, but not Numba
a[i]['x'] = i
a[i]['y'] = i+1
Point = np.dtype([('x', 'f4'), ('y', 'f4')])
a = np.empty((10,), dtype=Point)
f(a)
print(a)
I have to assign values to each field of a structured array record individually, as opposed to bulk assignment with a tuple. Is there a more concise way, which works with Numba?