What is the difference between resize and reshape when using arrays in NumPy?

后端 未结 5 907
天涯浪人
天涯浪人 2020-12-08 15:14

I have just started using NumPy. What is the difference between resize and reshape for arrays?

5条回答
  •  我在风中等你
    2020-12-08 15:46

    One more point is:

    np.reshape can take -1 in one dimension. np.resize can't.

    Example as below:

    arr = np.arange(20)
    arr.resize(5, 2, 2)
    arr.reshape(2, 2, -1)
    

提交回复
热议问题