回答編集履歴
1
コード修正
test
CHANGED
@@ -48,19 +48,11 @@
|
|
48
48
|
|
49
49
|
|
50
50
|
|
51
|
-
# 重複がある場合削除
|
52
|
-
|
53
|
-
ret = list(set(ret))
|
54
|
-
|
55
|
-
|
56
|
-
|
57
51
|
# 列を追加
|
58
52
|
|
59
|
-
for idx,val in enumerate(ret):
|
53
|
+
for idx,val in enumerate(ret[1:]): # 先頭要素は追加不要
|
60
54
|
|
61
|
-
i
|
55
|
+
row[idx+1] = val # 先頭列は追加不要(残しておく)
|
62
|
-
|
63
|
-
row[idx] = val
|
64
56
|
|
65
57
|
|
66
58
|
|
@@ -72,6 +64,20 @@
|
|
72
64
|
|
73
65
|
df = df.apply(func,axis=1)
|
74
66
|
|
67
|
+
print(df)
|
68
|
+
|
69
|
+
"""
|
70
|
+
|
71
|
+
0 1 2 3
|
72
|
+
|
73
|
+
0 AA11BB AA11_BB AA_11BB AA_11_BB
|
74
|
+
|
75
|
+
1 11AB22 11AB_22 11_AB22 11_AB_22
|
76
|
+
|
77
|
+
2 DD11 DD_11 NaN NaN
|
78
|
+
|
79
|
+
"""
|
80
|
+
|
75
81
|
df.to_csv('ret.txt',header=None,index=False)
|
76
82
|
|
77
83
|
```
|