- 1
- 0
- 约5.9千字
- 约 1页
- 2024-08-14 发布于广西
- 举报
PythonCheatSheet:NumPy
“Apuzzleadaytolearn,code,andplay”→Visit
Name
Description
Example
a.shape
TheshapeattributeofNumPyarrayakeepsatupleof
a=np.array([[1,2],[1,1],[0,0]])
integers.Eachintegerdescribesthenumberofelementsof
print(np.shape(a))#(3,2)
theaxis.
a.ndim
Thendimattributeisequaltothelengthoftheshapetuple.
print(np.ndim(a))#2
*
Theasterisk(star)operatorperformstheHadamardproduct,
a=np.array([[2,0],[0,2]])
i.e.,multipliestwomatriceswithequalshapeelement-wise.
b=np.array([[1,1],[1,1]])
print(a*b)#[[20][02]]
np.matmul(a,b),a@b
Thestandardmatrixmultiplicationoperator.Equivalenttothe
print(np.matmul(a,b))
@operator.
#[[22][22]]
np.arange([start,]stop,Createsanew1Dnumpyarraywithevenlyspacedvalues
print(np.arange(0,10,2))
[step,])
#[02468]
np.linspace(start,stop,Createsanew1Dnumpyarraywithevenlyspreadelements
print(np.linspace(0,10,3))
num=50)
您可能关注的文档
- 阿布扎比2030经济愿景.pdf
- 阿布扎比环境愿景2030 (1).pdf
- 从OpenAI的实际项目学Python_API.pdf
- 全世界最实用的Python秘籍.pdf
- GB/T 4937.37-2025半导体器件 机械和气候试验方法 第37部分:采用加速度计的板级跌落试验方法.pdf
- 中国国家标准 GB/T 46887-2025数字化供应链 体系架构.pdf
- JJG 458-2026总辐射表检定规程.pdf
- 《GB/T 4937.37-2025半导体器件 机械和气候试验方法 第37部分:采用加速度计的板级跌落试验方法》.pdf
- 《JJG 458-2026总辐射表检定规程》.pdf
- GB/T 46887-2025数字化供应链 体系架构.pdf
- 中国国家标准 GB/Z 37551.300-2026海洋能 波浪能、潮流能及其他水流能转换装置 第300部分:河流能转换装置发电性能评估.pdf
- GB/T 44937.3-2025集成电路 电磁发射测量 第3部分:辐射发射测量 表面扫描法.pdf
- 中国国家标准 GB/T 44937.3-2025集成电路 电磁发射测量 第3部分:辐射发射测量 表面扫描法.pdf
- 《GB/T 44937.3-2025集成电路 电磁发射测量 第3部分:辐射发射测量 表面扫描法》.pdf
- 中国国家标准 GB/T 44937.1-2025集成电路 电磁发射测量 第1部分:通用条件和定义.pdf
- GB/T 44937.1-2025集成电路 电磁发射测量 第1部分:通用条件和定义.pdf
- 《GB/T 44937.1-2025集成电路 电磁发射测量 第1部分:通用条件和定义》.pdf
- 中国国家标准 GB/T 4937.37-2025半导体器件 机械和气候试验方法 第37部分:采用加速度计的板级跌落试验方法.pdf
- 《GB/T 4937.10-2025半导体器件 机械和气候试验方法 第10部分:机械冲击 器件和组件》.pdf
- 中国国家标准 GB/T 44937.2-2025集成电路 电磁发射测量 第2部分:辐射发射测量TEM小室和宽带TEM小室法.pdf
原创力文档

文档评论(0)