0
b = np.concatenate((a, a[:,0]), axis=1)

ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 2 dimension(s) and the array at index 1 has 1 dimension(s)

eshirvana
  • 23,227
  • 3
  • 22
  • 38

1 Answers1

0

You have to use:

np.c_[a,a[:,0]]

otherwise you should reshape a[:,0] as:

np.concatenate((a,a[:,0].reshape(-1,1)), axis=1)

this because a[:,0] is a 1d array and you will not have a second axis (axis=1). This explains the error "the array at index 1 has 1 dimension(s)"