这是一个目录(后续我会继续补充)
- 对axis的理解
- 对shape的理解
- 基础属性
- 初始化
- 对数组
-
- reshape()
- np.nonzero()
- np.maximum,np.minimum
- .max(),.min(),.mean(),.sum(),.std(),np.abs()
- np.pad()
- np.diag()
- .diagonal()
- np.unravel_index()
- np.tile()
- np.dot()
- np.multiply(),np.add(),np.divide(),np.negative()
- np.ceil(),np.floor()
- np.copysign()
- np.intersect1d(),np.union1d()
- np.sqrt(),np.emath.sqrt()
- .astype(),.trunc()
- np.linspace()
- .sort()
- np.add.reduce()
- np.array_equal(),np.allclose()
- .argmax(),.argmin(),.argsort()
- np.meshgrid()
- np.subtract.outer()
- np.atleast_2d()
- np.ndenumerate(),np.ndindex()
- np.put()
- .any(),.all()
- np.bincount()
- np.unique()
- np.roll()
- np.repeat,.repeat()
- np.cumsum()
- np.logical_not
- np.linalg.svd(),np.linalg.det()
- stride_tricks.as_strided()
- np.maximum(),np.minimum()
- np.tensordot
- np.add.reduceat
- np.add.reduce
- np.where
- np.interp
- np.indices
- np.percentile
- np.power()
- np.stack()
- np.squeeze()
- np.transpose
- np.swapaxes
- 对字符串
对axis的理解
如果shape=(2,3,4)
那么这三个对应的aixs即为0,1,2,相应维度操作即可。
对shape的理解
当你.shape时,[1,2,3].shape=(3,)所以说在numpy中一维是这样表示的
对于(3,1)这表示的是二维array,[[1,2,3]].shape=(1,3)
基础属性
size itemsize shape ndim dtype
np.nan ,np .inf
可用isnan,isinf判断
Z.flags.writeable
Z.flags.writeable = False #只可读,不可写
np.newaxis(None)
~
取反
初始化
np.zeros(),np.ones()
np.arange()
np.eye()
np.random.random()
[0,1)上的随机浮点数
np.random.uniform()
Z = np.random.uniform(-10,+10,(10,10))
返回-10-10上维度为(10,10)的均匀分布的数(抽样)
np.random.randint()
Z1 = np.random.randint(0,10,10):0-10上随机取整数
np.random.choice()
np.random.rand()
从【0,1)的均匀分布式上采样
np.random.shuffle()
np.random.randn
标准正太分布