Sometimes it is necessary to explicitly request that the data be copied. This is simply achieved with the NumPy function called array:
M = array([[1.,2.],[3.,4.]]) N = array(M.T) # copy of M.T
We can verify that the data has indeed been copied:
N.base is None # True
In this section, you saw the concept of array views. NumPy works with views instead of copies of a given array to save memory, which – especially for large arrays – can be crucial. On the other hand, unintentionally using views may cause programming errors that are hard to debug.Â