(Python Numpy)ValueError:操作数无法与形状(0,)(3,)一起广播

(Python Numpy)ValueError:操作数无法与形状(0,)(3,)一起广播,python,numpy,Python,Numpy,这个错误意味着什么 Traceback (most recent call last): File "/tmp/sessions/f61d58dd874eadb8/main.py", line 38, in <module> print("Determinant of the matrix is : ",determinant_recursive(mat,N)) File "/tmp/sessions/f61d58dd874eadb8/main.py", line 2

这个错误意味着什么

Traceback (most recent call last):
  File "/tmp/sessions/f61d58dd874eadb8/main.py", line 38, in <module>
    print("Determinant of the matrix is : ",determinant_recursive(mat,N))
  File "/tmp/sessions/f61d58dd874eadb8/main.py", line 22, in determinant_recursive
    As[i] = As[i][0:fc] + As[i][fc+1:] 
ValueError: operands could not be broadcast together with shapes (0,) (3,) 
回溯(最近一次呼叫最后一次):
文件“/tmp/sessions/f61d58dd874eadb8/main.py”,第38行,在
print(“矩阵的行列式为:”,行列式_递归(mat,N))
文件“/tmp/sessions/f61d58dd874eadb8/main.py”,行列式_中的第22行
As[i]=As[i][0:fc]+As[i][fc+1:]
ValueError:操作数无法与形状(0,)(3,)一起广播

如果
fc
0
,它的目标是将
元素相加为[i][0:0]
(因此是一个不包含元素的数组),并将
作为[i][1:][/code>(因此除第一个之外的所有元素),因为这两个元素的数量不相同,因此它无法将项目相加。
+
应该在这里做什么?是否正在添加两个数组(元素之和)?连接两个列表或字符串?该错误表示您有数组。只有当数组的元素数相同时,这种求和才有效。