python - How do you create a numpy vertical arange? -
>>> print np.array([np.arange(10)]).transpose() [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]
is there way vertical arange without having go through these steps?
you can use np.newaxis:
>>> np.arange(10)[:, np.newaxis] array([[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]])
np.newaxis
alias none
, , added numpy
developers readability. therefore np.arange(10)[:, none]
produce same exact result above solution.
Comments
Post a Comment