Python: Add a column to numpy 2d array

后端 未结 5 1251
醉酒成梦
醉酒成梦 2021-01-02 04:44

I have a 60000 by 200 numpy array. I want to make it 60000 by 201 by adding a column of 1\'s to the right. (so every row is [prev, 1]) Concatenate with axis = 1 doesn\'t wor

5条回答
  •  囚心锁ツ
    2021-01-02 05:40

    I think the numpy method column_stack is more interesting because you do not need to create a column numpy array to stack it in the matrix of interest. With the column_stack you just need to create a normal numpy array.

提交回复
热议问题