Numpy array memory issue

后端 未结 2 1814
难免孤独
难免孤独 2021-02-06 13:53

I believe I am having a memory issue using numpy arrays. The following code is being run for hours on end:

    new_data = npy.array([new_x, new_y1, new_y2, new_y         


        
2条回答
  •  醉话见心
    2021-02-06 14:33

    Use Python lists. Seriously, they grow far more efficiently. This is what they are designed for. They are remarkably efficient in this setting.

    If you need to create an array out of them at the end (or even occasionally in the midst of this computation), it will be far more efficient to accumulate in a list first.

提交回复
热议问题