I am trying to concat two valid array via np.concat() method.
My code:
print X_train.shape, train_names.shape
X_train = np.concatenate([train_names,X_train], axis=0)
The output:
(3545, 93355) (3545, 692)
ValueError Traceback (most recent call last)
<ipython-input-58-59dc66874663> in <module>()
1 print X_train.shape, train_names.shape
----> 2 X_train = np.concatenate([train_names,X_train], axis=0)
ValueError: zero-dimensional arrays cannot be concatenated
As you can see, the shapes of arrays align, still I am getting this weird error. Why?
EDIT: I have tried with axis=1 as well. Same result
EDIT 2: Eqauted data types using .astype(np.float64). Same result.
dtypeof the inputs. Something in the input to thenp.concatenateiszero-dimensional. We can't see it, but you will if you add enough diagnostic prints.scipy sparse matrixtype? Since it works for smaller arrays, I suspect a memory or indexing issue. We need to look for otherconcatenateerror questions.scipy sparsedon't usenp.concatenate. Only usesparsefunctions.