質問編集履歴
2
使用しているライブラリの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
```python
|
2
|
+
|
3
|
+
import numpy as np
|
4
|
+
|
5
|
+
import pandas as pd
|
6
|
+
|
7
|
+
|
2
8
|
|
3
9
|
for i in range(5):
|
4
10
|
|
5
|
-
train_df["generation{}".format(i)]
|
11
|
+
train_df["generation{}".format(i)]=np.nan
|
6
12
|
|
7
13
|
```
|
8
14
|
|
1
思いつく例えばの形を追記
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
python、
|
1
|
+
python、列を複数作りたい
|
test
CHANGED
@@ -38,4 +38,16 @@
|
|
38
38
|
|
39
39
|
今現在はこのように効率の悪い書き方になっています。
|
40
40
|
|
41
|
+
上のようなものをべた書きじゃない形で
|
42
|
+
|
43
|
+
```python
|
44
|
+
|
45
|
+
for i in range(5):
|
46
|
+
|
47
|
+
train_selected_generation_{}.format(i)_male = tr_selected_male[tr_selected_male["generation_{}".format(i)].isin([1])]
|
48
|
+
|
49
|
+
```
|
50
|
+
|
51
|
+
例えば上のような形で
|
52
|
+
|
41
53
|
同じようなものを大量に複数作りたいのですが何かいい書き方があれば教えていただきたいです。
|