Initialize Multiple Numpy Arrays (Multiple Assignment) - Like MATLAB deal()

前端 未结 4 629
花落未央
花落未央 2020-12-14 23:32

I was unable to find anything describing how to do this, which leads to be believe I\'m not doing this in the proper idiomatic Python way. Advice on the \'proper\' Python w

4条回答
  •  情歌与酒
    2020-12-15 00:25

    How about using map:

    import numpy as np
    n = 10  # Number of data points per array
    m = 3   # Number of arrays being initialised
    gData, pData, qData = map(np.zeros, [n] * m)
    

提交回复
热议问题