python numpy 怎么获取矩阵的第i个数据
展开全部
>>> arr
[[10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
[11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
[12, 13, 14, 15, 16, 17, 18, 19, 20, 21],
[13, 14, 15, 16, 17, 18, 19, 20, 21, 22],
[14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
[15, 16, 17, 18, 19, 20, 21, 22, 23, 24],
[16, 17, 18, 19, 20, 21, 22, 23, 24, 25],
[17, 18, 19, 20, 21, 22, 23, 24, 25, 26],
[18, 19, 20, 21, 22, 23, 24, 25, 26, 27],
[19, 20, 21, 22, 23, 24, 25, 26, 27, 28],
[20, 21, 22, 23, 24, 25, 26, 27, 28, 29],
[21, 22, 23, 24, 25, 26, 27, 28, 29, 30]]
>>> l = [x[0] for x in arr]
>>> l
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
>>>
[[10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
[11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
[12, 13, 14, 15, 16, 17, 18, 19, 20, 21],
[13, 14, 15, 16, 17, 18, 19, 20, 21, 22],
[14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
[15, 16, 17, 18, 19, 20, 21, 22, 23, 24],
[16, 17, 18, 19, 20, 21, 22, 23, 24, 25],
[17, 18, 19, 20, 21, 22, 23, 24, 25, 26],
[18, 19, 20, 21, 22, 23, 24, 25, 26, 27],
[19, 20, 21, 22, 23, 24, 25, 26, 27, 28],
[20, 21, 22, 23, 24, 25, 26, 27, 28, 29],
[21, 22, 23, 24, 25, 26, 27, 28, 29, 30]]
>>> l = [x[0] for x in arr]
>>> l
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
>>>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询