发布于2021-07-25 07:43 阅读(1756) 评论(0) 点赞(3) 收藏(0)
import numpy as np
a1 =np.arange(10)
a1[a1%2>0]=-1
a1
Out[26]:
array([ 0, -1, 2, -1, 4, -1, 6, -1, 8, -1])
import numpy as np
a2 = np.arange(16).reshape((4,4))
a2
a22=np.eye(4,4,dtype=int,order=1)
a2[a22>0]
Out[57]:
array([ 0, 5, 10, 15])
import numpy as np
a3 = np.arange(16).reshape((4,4))
a3
a3[0,0]
a3[1,2]
a3[3,2]
14
import numpy as np
a4 = np.arange(16).reshape((4,4))
a4[1:3]
Out[71]:
array([[ 4, 5, 6, 7],
[ 8, 9, 10, 11]])
import numpy as np
a5 = np.arange(72).reshape((8,9))
a5=((a5[:5,7:8]))
a5[a5>3]
Out[120]:
array([ 7, 16, 25, 34, 43])
原文链接:https://blog.csdn.net/weixin_38406825/article/details/119038564
作者:火腿快跑
链接:http://www.pythonpdf.com/blog/article/526/212315a30bd5a24b5b09/
来源:编程知识网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!