I was wondering if there\'s a function that takes a list X
as input and outputs a column vector corresponding to X
?
(I looked around and I susp
I don't think there is a function, but there is a dedicated object, np.c_
>>> X = list('hello world')
>>> X
['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
np.c_[X]
array([['h'],
['e'],
['l'],
['l'],
['o'],
[' '],
['w'],
['o'],
['r'],
['l'],
['d']], dtype='
You can also do (note the extra square brackets)
>>> np.array([X]).T