I have looked online for the past 4 hours and I have not been able to find a solution to this that works. It's such a stupid problem that I didn't want to ask it so I wouldn't get downvoted, but here goes nothing.
The task:
I have a (1xN
) csr matrix and I want to simply make it (1xN+1
) matrix by adding the number "1" to the end.
Everything I tried and the errors:
vstack(xi, np.ones((1,1)))
:
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')
hstack(xi, np.ones((1,1)))
:
ValueError: blocks must be 2-D
np.concatenate([xi, [np.ones(1)]])
:
ValueError: zero-dimensional arrays cannot be concatenated
xi = np.concatenate([xi, np.ones(1)])
:
ValueError: zero-dimensional arrays cannot be concatenated
and so many variants of the above... please anybody help I've been on this for so long and I'm thinking of giving up on this entire project.