回答編集履歴
1
Update
test
CHANGED
@@ -8,21 +8,27 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
df = pd.DataFrame({
|
11
|
+
df_A = pd.DataFrame({
|
12
12
|
|
13
13
|
'Col_1': [1, 2, 3, 4],
|
14
14
|
|
15
|
-
'Col_2': [
|
15
|
+
'Col_2': ['a, b, c', 'a, d', np.nan, 'e'],
|
16
16
|
|
17
17
|
})
|
18
18
|
|
19
19
|
|
20
20
|
|
21
|
+
|
22
|
+
|
23
|
+
df_B = df_A.copy()
|
24
|
+
|
25
|
+
df_B['Col_2'] = df_B['Col_2'].str.split(',')
|
26
|
+
|
21
|
-
df
|
27
|
+
df_B = df_B.explode('Col_2').dropna().reset_index(drop=True)
|
22
28
|
|
23
29
|
|
24
30
|
|
25
|
-
print(df
|
31
|
+
print(df_B)
|
26
32
|
|
27
33
|
|
28
34
|
|