Hi Everyone,
I am receiving a getitem Typing error and I am having trouble deciphering it. Does anyone have any suggestions for what I can change? I’m wondering if its the concatenate or argsort but it could be something else.
@numba.jit(nopython=True, parallel=True)
def QuadDs(y):
#output = np.zeros_like(result)
for m in numba.prange(y.shape[2]):
for j in numba.prange(y.shape[0]):
set1 = np.zeros(((y.shape[1]),3))
q = y[j,:,m]
for i in numba.prange(len(q)):
set1[i,0] = q[i]
for i in numba.prange(set1.shape[0]):
if (set1[i,0] == -1): ### Losers
set1[i,2] = i
if (set1[i,0] == 1): ### Winners
set1[i,1] = i
setUp = set1[:,[0,1]][set1[:,1] != 0]
setDown = set1[:,[0,2]][set1[:,2] != 0]
x = np.concatenate((setUp,setDown))
x2 = x[x[:,1].argsort()]
x3 = np.zeros((len(x2),1))
x4 = np.append(x2, x3, 1)
c2 = x4
u = 0
d = 0
for i in numba.prange(c2.shape[0]):
if (i == 0):
if (c2[i,0] == 1):
c2[i,2] = 1
u = 1
if (c2[i,0] == -1):
c2[i,2] = -1
d = 1
if (i!=0):
if ((c2[i,0] == 1) and (u != 0)):
d = 0
u += 1
if (c2[i,1]-c2[i-1,1] != 1):
c2[i-1,2] = u-1
u = 1
if ((c2[i,0] == 1) and (d != 0)):
c2[i-1,2] = -d
u = 1
d = 0
if ((c2[i,0] == -1) and (d != 0)):
u = 0
d += 1
if (c2[i,1]-c2[i-1,1] != 1):
c2[i-1,2] = -d+1
d = 1
if ((c2[i,0] == -1) and (u != 0)):
c2[i-1,2] = u
u = 0
d = 1
if (i == 1):
if (c2[i-1,0] == c2[i,0]):
c2[0,2] = 0
if (i == c2.shape[0]-1):
c2[i,2] = u - d
u = 0
d = 0
QuadDs(result2) #result two is a 3d numpy array
getitem(array(float64, 2d, C), Tuple(slice<a:b>, list(int64)<iv=[0, 1]>))
There are 22 candidate implementations:
- Of which 20 did not match due to:
Overload of function ‘getitem’: File: : Line N/A.
With argument(s): ‘(array(float64, 2d, C), Tuple(slice<a:b>, list(int64)<iv=None>))’:
No match.
- Of which 1 did not match due to:
Overload in function ‘GetItemBuffer.generic’: File: numba/core/typing/arraydecl.py: Line 209.
With argument(s): ‘(array(float64, 2d, C), Tuple(slice<a:b>, list(int64)<iv=None>))’:
Rejected as the implementation raised a specific error:
NumbaTypeError: Unsupported array index type list(int64)<iv=None> in Tuple(slice<a:b>, list(int64)<iv=None>)
raised from /home/calc1/anaconda3/envs/python38/lib/python3.8/site-packages/numba/core/typing/arraydecl.py:102
- Of which 1 did not match due to:
Overload in function ‘GetItemBuffer.generic’: File: numba/core/typing/arraydecl.py: Line 209.
With argument(s): ‘(array(float64, 2d, C), Tuple(slice<a:b>, list(int64)<iv=[0, 1]>))’:
Rejected as the implementation raised a specific error:
NumbaTypeError: Unsupported array index type list(int64)<iv=[0, 1]> in Tuple(slice<a:b>, list(int64)<iv=[0, 1]>)
raised from /home/calc1/anaconda3/envs/python38/lib/python3.8/site-packages/numba/core/typing/arraydecl.py:102
During: typing of intrinsic-call at /tmp/ipykernel_12611/2696172255.py (18)
During: typing of static-get-item at /tmp/ipykernel_12611/2696172255.py (18)
Thanks