![图片[1]-python怎么取矩阵的转置?-uusu优素-乐高,模型,3d打印,编程](http://uusucn.zbbe.cn/wp-content/uploads/2024/01/5eb4c1036559a744.jpg)
python中可以使用np.transpose()方法获取矩阵的转置。
np.transpose()函数的作用是将数组按指定的轴来进行转置并返回结果。
示例:
importnumpyasnp a=np.arange(16).reshape((4,4)) print(a) ''' [[0123] [4567] [891011] [12131415]] ''' a=np.transpose(a) print(a) ''' [[04812] [15913] [261014] [371115]] '''原文来自:https://www.py.cn
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END

















































暂无评论内容