回答編集履歴
2
Update
test
CHANGED
@@ -7,6 +7,10 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
df = pd.read_csv('01.csv')
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
# print(df['Time'].str.extract(r'((\d+)([dhm]))?\s*((\d+)([dhm]))?\s*((\d+)([dhm]))').fillna(0))
|
10
14
|
|
11
15
|
|
12
16
|
|
1
Update
test
CHANGED
@@ -10,15 +10,19 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
+
sec = {'d': 86400, 'h': 3600, 'm': 60, 0: 0}
|
14
|
+
|
13
15
|
df['Time(second)'] = (
|
14
16
|
|
15
17
|
df['Time'].str
|
16
18
|
|
17
|
-
.extract(r'((\d+)d)?\s*((\d+)h)?\s*((\d+)m)
|
19
|
+
.extract(r'((\d+)([dhm]))?\s*((\d+)([dhm]))?\s*((\d+)([dhm]))')
|
18
20
|
|
19
|
-
.fillna(0).astype({1: int,
|
21
|
+
.fillna(0).astype({1: int, 4: int, 7: int})
|
20
22
|
|
23
|
+
.apply(lambda x:
|
24
|
+
|
21
|
-
|
25
|
+
x[1]*sec[x[2]] + x[4]*sec[x[5]] + x[7]*sec[x[8]], axis=1))
|
22
26
|
|
23
27
|
|
24
28
|
|
@@ -38,7 +42,7 @@
|
|
38
42
|
|
39
43
|
3 50m 3000
|
40
44
|
|
41
|
-
4 11h 22d
|
45
|
+
4 11h 22d 1940400
|
42
46
|
|
43
47
|
5 30d 11h 3m 2631780
|
44
48
|
|