1D numpy concatenate: TypeError: only integer scalar arrays can be converted to a scalar index
Question:
I want to store numpy array into to another numpy array
I am using np.concatenate
This is my code
x=np.concatenate(x,s_x)
These are the type and the shape of x and s_x
Type of s_x: <class 'numpy.ndarray'>, Shape of s_x: (173,)
Type of x: <class 'numpy.ndarray'> (0,), Shape of x: (0,)
This is the error being displayed
TypeError: only integer scalar arrays can be converted to a scalar index
Answers:
You need to pass the arrays as an iterable (a tuple or list), thus the correct syntax is
x=np.concatenate((x, s_x))
I want to store numpy array into to another numpy array
I am using np.concatenate
This is my code
x=np.concatenate(x,s_x)
These are the type and the shape of x and s_x
Type of s_x: <class 'numpy.ndarray'>, Shape of s_x: (173,)
Type of x: <class 'numpy.ndarray'> (0,), Shape of x: (0,)
This is the error being displayed
TypeError: only integer scalar arrays can be converted to a scalar index
You need to pass the arrays as an iterable (a tuple or list), thus the correct syntax is
x=np.concatenate((x, s_x))