Numpy数组之深拷贝

我是跟着numpy官方中文文档敲的代码,官方中文文档网址为:https://www.numpy.org.cn/user_guide/quickstart_tutorial/deep_copy.html

copy 方法生成数组及其数据的完整拷贝。

>>> d = a.copy()
>>> d
array([[ 0,  1,  2,  3],
       [ 4,  5,  6,  7],
       [ 8,  9, 10, 11]])
>>> d is a
False
>>> d.base is a
False
>>> d[0,0] = 45678
>>> d
array([[45678,     1,     2,     3],
       [    4,     5,     6,     7],
       [    8,     9,    10,    11]])
>>> a
array([[ 0,  1,  2,  3],
       [ 4,  5,  6,  7],
       [ 8,  9, 10, 11]])
>>> 

函数和方法概述
这里是官方文档列出来的一些根据类别排列的有用的NumPy函数和方法名称。

数组创建
arange, array, copy, empty, empty_like, eye, fromfile, fromfunction, identity, linspace, logspace, mgrid, ogrid, ones, ones_like, r, zeros, zeros_like

转换
ndarray.astype, atleast_1d, atleast_2d, atleast_3d, mat

手法
array_split, column_stack, concatenate, diagonal, dsplit, dstack, hsplit, hstack, ndarray.item, newaxis, ravel, repeat, reshape, resize, squeeze, swapaxes, take, transpose, vsplit, vstack

问题
all, any, nonzero, where

顺序
argmax, argmin, argsort, max, min, ptp, searchsorted, sort

操作
choose, compress, cumprod, cumsum, inner, ndarray.fill, imag, prod, put, putmask, real, sum

基本统计
cov, mean, std, var

基本线性代数
cross, dot, outer, linalg.svd, vdot

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值