python机器学习库numpy---4.3、n维数组的创建(特殊数组)
python机器学习库numpy---4.3、n维数组的创建(特殊数组)
一、总结
一句话总结:
numpy中常用的特殊矩阵 主要有ones(全1)、zeros(全0)、eye(单位矩阵)、empty(未初始化)
二、n维数组的创建(特殊数组)
博客对应课程的视频位置:4.3、n维数组的创建(特殊数组)-范仁义-读书编程笔记
https://www.fanrenyi.com/video/38/344
4.3、n维数组的创建(特殊数组)
numpy中常用的特殊矩阵 主要有ones(全1)、zeros(全0)、eye(单位矩阵)、empty(未初始化)
In [2]:
# 需要一个表示矩阵维度的元组做参数
arr=np.ones((2,3))
print(arr)
In [4]:
arr=np.zeros((3,2))
print(arr)
In [5]:
arr=np.eye(3)
print(arr)
In [6]:
help(np.eye)
In [7]:
arr=np.empty((4,6))
print(arr)
In [ ]:
版权申明:欢迎转载,但请注明出处
一些博文中有一些参考内容因时间久远找不到来源了没有注明,如果侵权请联系我删除。
在校每年国奖、专业第一,加拿大留学,先后工作于华东师范大学和香港教育大学。
2024-09-05:27岁,宅加太忙,特此在网上找女朋友,vx:fan404006308
AI交流资料群:753014672