shape函数是numpy.core.fromnumeric中的函数,它的功能是读取矩阵的长度。

1 >>> a=mat([[1,2,3],[5,6,9]]);
2 >>> a
3 matrix([[1, 2, 3],
4         [5, 6, 9]])
5 >>> shape(a)[0]
6 2
7 >>> shape(a)[1]
8 3

如上面的a矩阵,2行3列;计算行使用shape(a)[0];计算列使用shape(a)[1];

 

相关文章:

  • 2022-12-23
  • 2022-01-03
  • 2021-08-20
  • 2023-04-09
  • 2021-12-01
  • 2021-06-26
  • 2021-08-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2021-12-06
相关资源
相似解决方案