【发布时间】:2014-01-29 21:24:45
【问题描述】:
我有一个 n 行的多维数组 q 和另一个 n 行的多维数组 q2。这些数组包含相同的行,但顺序不同。如何获得 2 个数组的匹配列表/数组?示例如下:
q=array([a,b,c,d], #row 1
[e,f,g,h], #row 2
[i,l,m,n]) #row 3
q2=array([e,f,g,h], #row 2
[a,b,c,d], #row 1
[i,l,m,n]) #row 3
q_index=[1,2,3]
q2_index=? #I know is [2,1,3] but I can I get it?
我需要创建索引的 q 列表/数组和相关的索引 q2 列表/数组列表。 谢谢
【问题讨论】:
-
请同时发布预期的输出。
-
我需要 q2_index 列表/数组 ty @AshwiniChaudhary
-
什么是a、b、c...?数字、字符串?
-
浮点数@thf435
-
所以澄清一下,q2_index 应该是 [2,1,3]?
标签: python arrays list indexing