How to copy data from a numpy array to another

前端 未结 7 1687
逝去的感伤
逝去的感伤 2020-11-28 03:07

What is the fastest way to copy data from array b to array a, without modifying the address of array a. I need this because an external library (PyFFTW) uses a pointer to my

7条回答
  •  清酒与你
    2020-11-28 03:40

    NumPy version 1.7 has the numpy.copyto function that does what you are looking for:

    numpy.copyto(dst, src)

    Copies values from one array to another, broadcasting as necessary.

    See: https://docs.scipy.org/doc/numpy/reference/generated/numpy.copyto.html

提交回复
热议问题