numpy array creating with a sequence

后端 未结 9 1374
陌清茗
陌清茗 2020-12-15 20:34

I am on my transitional trip from MATLAB to scipy(+numpy)+matplotlib. I keep having issues when implementing some things. I want to create a simple vector array in three dif

9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-15 21:00

    Easiest way using numpy.repeat() ||| numpy.tile()

    a = np.array([1,2,3,4,5])
    
    np.r_[np.repeat(a,3),np.tile(a,3)]
    

提交回复
热议问题