Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

1D numpy concatenate: TypeError: only integer scalar arrays can be converted to a scalar index [duplicate]

People also ask

How do I fix TypeError only integer scalar arrays can be converted to a scalar index?

Error encountered is: "TypeError: only integer scalar arrays can be converted to a scalar index". This error comes when we handle Numpy array in the wrong way using Numpy utility functions. The fix is to refer the documentation of the Numpy function and use the function correctly.


You need to pass the arrays as an iterable (a tuple or list), thus the correct syntax is

x=np.concatenate((x, s_x))