7/28/2017 - 5:11 PM

numpy_reshape from https://docs.scipy.org/doc/numpy/reference/generated/numpy.reshape.html#numpy.reshape

It is not always possible to change the shape of an array without copying the data.
If you want an error to be raise if the data is copied, you should assign the new 
shape to the shape attribute of the array:

>>> a = np.zeros((10, 2))
# A transpose make the array non-contiguous
>>> b = a.T
# Taking a view makes it possible to modify the shape without modifying
# the initial object.
>>> c = b.view()
>>> c.shape = (20)
AttributeError: incompatible shape for a non-contiguous array

The order keyword gives the index ordering both for fetching the values from a
and then placing the values into the output array. For example, let’s say you have an array:

>>> a = np.arange(6).reshape((3, 2))
>>> a
array([[0, 1],
       [2, 3],
       [4, 5]])