Extracting specific columns in numpy array

前端 未结 9 1292
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 02:27

This is an easy question but say I have an MxN matrix. All I want to do is extract specific columns and store them in another numpy array but I get invalid syntax errors. He

9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 02:37

    One thing I would like to point out is, if the number of columns you want to extract is 1 the resulting matrix would not be a Mx1 Matrix as you might expect but instead an array containing the elements of the column you extracted.

    To convert it to Matrix the reshape(M,1) method should be used on the resulting array.

提交回复
热议问题