- np.array()/np.asarray()
- reshape/resize
- 结构化数据
- ndim/itemsize/flags
- frombuffer()/fromiter()???
# 对于非ndarray的数据 .array()和.asarray()是深拷贝 a=list(range(10)) a1=np.array(a) a2=np.array(a) # 对于ndarray的数据 .array()是深拷贝;.asarray()是浅拷贝 b=list(range(10)) b1=np.array(b) b2=np.array(b)reshape/resize
https://blog.csdn.net/weixin_38094100/article/details/115110443
reshape 是浅拷贝,且不支持inplace操作
np.reshape(data,(shape,...)) data.reshape(shape,...)
resize 是深拷贝,既支持inplace操作也支持非inplace操作
data.resize(shape,...) # inplace操作 np.resize(shape,...) # 非inplace操作结构化数据
https://blog.csdn.net/qq_45488242/article/details/105895653
通过字典来创建结构化数组的数据类型
import numpy as np
# versioin 1
d1={'names':('name','age','weight'),'formats':('U10','i4','f8')}
array1=np.zeros(4,dtype=d1)
# version 2
d2=[('name','U10'),('age','i4'),('weight','f8')]
array2=np.zeros(4,dtype=d2)
ndim/itemsize/flags
# ndim len(data.shape)=data.ndim # data: ndarray # itemsize data.itemsize # 数据中每个元素的大小,以字节为单位 # flags data.flags # 数组的存储形式,字节码呈现frombuffer()/fromiter()???
http://c.biancheng.net/numpy/array-create.html



