回答編集履歴
3
q
test
CHANGED
@@ -42,7 +42,7 @@
|
|
42
42
|
|
43
43
|
array1 = array1[comm1]
|
44
44
|
|
45
|
-
|
45
|
+
array2 = array2[comm2]
|
46
46
|
|
47
47
|
print(array1)
|
48
48
|
|
2
a
test
CHANGED
@@ -1,19 +1,3 @@
|
|
1
|
-
cmake_minimum_required(VERSION 3.1.0)
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
project(sample)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
file(GLOB_RECURSE SOURCE_FILES liblinear/*.cpp main.cpp)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
|
14
|
-
|
15
|
-
|
16
|
-
|
17
1
|
numpy でしたら、[numpy.intersect1d()](https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.intersect1d.html) で共通するインデックスを探すことで実現できます。
|
18
2
|
|
19
3
|
|
1
あ
test
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
cmake_minimum_required(VERSION 3.1.0)
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
project(sample)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
file(GLOB_RECURSE SOURCE_FILES liblinear/*.cpp main.cpp)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
|
14
|
+
|
15
|
+
|
16
|
+
|
1
17
|
numpy でしたら、[numpy.intersect1d()](https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.intersect1d.html) で共通するインデックスを探すことで実現できます。
|
2
18
|
|
3
19
|
|
@@ -10,15 +26,15 @@
|
|
10
26
|
|
11
27
|
array1 = np.array([[1, '山田', 18],
|
12
28
|
|
13
|
-
|
29
|
+
[2, '田中', 28],
|
14
30
|
|
15
|
-
|
31
|
+
[3, '佐藤', 38],
|
16
32
|
|
17
|
-
|
33
|
+
[4, '安藤', 12]])
|
18
34
|
|
19
35
|
array2 = np.array([[1, '東京'],
|
20
36
|
|
21
|
-
|
37
|
+
[3, '群馬']])
|
22
38
|
|
23
39
|
# 各配列の1列目は index のリスト
|
24
40
|
|