本文簡要介紹 python 語言中 numpy.recarray.copy 的用法。
用法:
recarray.copy(order='C')返回數組的副本。
- order: {‘C’、‘F’、‘A’、‘K’},可選
控製副本的內存布局。 “C”表示C-order,“F”表示F-order,“A”表示“F”,如果a是 Fortran 連續的,否則為“C”。 ‘K’表示匹配布局a盡可能接近。 (請注意,此函數和numpy.copy非常相似,但它們的 order= 參數具有不同的默認值,並且此函數始終傳遞子類。)
參數:
注意:
此函數是創建數組副本的首選方法。函數
numpy.copy類似,但默認使用順序‘K’,默認不傳遞子類。例子:
>>> x = np.array([[1,2,3],[4,5,6]], order='F')>>> y = x.copy()>>> x.fill(0)>>> x array([[0, 0, 0], [0, 0, 0]])>>> y array([[1, 2, 3], [4, 5, 6]])>>> y.flags['C_CONTIGUOUS'] True
相關用法
- Python numpy recarray.ctypes用法及代碼示例
- Python numpy recarray.dot用法及代碼示例
- Python numpy recarray.itemset用法及代碼示例
- Python numpy recarray.view用法及代碼示例
- Python numpy recarray.tolist用法及代碼示例
- Python numpy recarray.setflags用法及代碼示例
- Python numpy recarray.flat用法及代碼示例
- Python numpy recarray.sort用法及代碼示例
- Python numpy recarray.astype用法及代碼示例
- Python numpy recarray.itemsize用法及代碼示例
- Python numpy recarray.tostring用法及代碼示例
- Python numpy recarray.flatten用法及代碼示例
- Python numpy recarray.item用法及代碼示例
- Python numpy recarray.getfield用法及代碼示例
- Python numpy recarray.ndim用法及代碼示例
- Python numpy recarray.byteswap用法及代碼示例
- Python numpy recarray.size用法及代碼示例
- Python numpy recarray.T用法及代碼示例
- Python numpy recarray.nbytes用法及代碼示例
- Python numpy recarray.fill用法及代碼示例
- Python numpy recarray.strides用法及代碼示例
- Python numpy recarray.resize用法及代碼示例
- Python numpy recarray.newbyteorder用法及代碼示例
- Python numpy recarray.transpose用法及代碼示例
- Python numpy recarray.partition用法及代碼示例
注:本文由純淨天空篩選整理自numpy.org大神的英文原創作品 numpy.recarray.copy。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
