import numpy as np return_ary=np.array([[0.003731,0.021066,-0.004854,0.006098,-0.00606], [-0.001838,0.001842,-0.016544,-0.003738,0.003752], [-0.003087,-0.000344,-0.033391,0.007123,0.004597], [-0.024112,0.011704,-0.029563,-0.01457,0.016129]]) sub_ary=np.concatenate((return_ary[0:2,1].reshape(2,1)),(return_ary[2:4,2:4].reshape(2,2)),axis=1) sub_ary哪里错了
时间: 2023-05-24 13:05:01 浏览: 88
numpy-1.26.4-cp311-cp311-win_amd64.whl
5星 · 资源好评率100%
代码中有错误。可以改为以下代码:
import numpy as np
return_ary=np.array([[0.003731,0.021066,-0.004854,0.006098,-0.00606],
[-0.001838,0.001842,-0.016544,-0.003738,0.003752],
[-0.003087,-0.000344,-0.033391,0.007123,0.004597],
[-0.024112,0.011704,-0.029563,-0.01457,0.016129]])
sub_ary=np.concatenate((return_ary[0:2,1].reshape(2,1),
return_ary[2:4,2:4]),axis=1)
print(sub_ary)
阅读全文