回答編集履歴
1
追記
test
CHANGED
@@ -29,3 +29,33 @@
|
|
29
29
|
print(b)# ['a', 'b', 'd']
|
30
30
|
|
31
31
|
```
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
なお、重複削除を`pandas`に任せる手もあります。
|
36
|
+
|
37
|
+
```Python
|
38
|
+
|
39
|
+
import pandas as pd
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
a=[2,1,2,3]
|
44
|
+
|
45
|
+
b=list('abcd')
|
46
|
+
|
47
|
+
c=list('wxyz')
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
sr = pd.Series(a).drop_duplicates()
|
52
|
+
|
53
|
+
a, b, c = [pd.Series(l).iloc[sr.index].tolist() for l in [a,b,c]]
|
54
|
+
|
55
|
+
print(a)# [2, 1, 3]
|
56
|
+
|
57
|
+
print(b)# ['a', 'b', 'd']
|
58
|
+
|
59
|
+
print(c)# ['w', 'x', 'z']
|
60
|
+
|
61
|
+
```
|