70

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
Santhosh
  • 1,554
  • 1
  • 13
  • 19

1 Answers1

159

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

x=np.concatenate((x, s_x))
Nils Werner
  • 34,832
  • 7
  • 76
  • 98