TypeError: only integer scalar arrays can be converted to a scalar index
data = np.array([
[5.0, 3.0, 4.0, 4.0, 0.0],
[3.0, 1.0, 2.0, 3.0, 3.0],
[4.0, 3.0, 4.0, 3.0, 5.0],
])
a=np.array([1.,2.,3.]);
a=a.reshape(3,1)
print(np.concatenate(a,data,axis=-1))
报错:
Traceback (most recent call last):
File “/test.py”, line 37, in
print(np.concatenate(a,data,axis=-1))
TypeError: only integer scalar arrays can be converted to a scalar index
Process finished with exit code 1
改正:
np.concatenate((a,data),axis=-1)