質問編集履歴
1
詳細ソースコードを記載
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,9 +14,35 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
```
|
17
|
+
```Python
|
18
18
|
|
19
|
+
import numpy as np
|
20
|
+
|
21
|
+
import pandas as pd
|
22
|
+
|
23
|
+
import datetime
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
lfs = pd.DataFrame(data={0.521558, 0.042841, 0.086858, 0.348744}, index={'AAA', 'BBB', 'CCC', 'DDD'})
|
28
|
+
|
29
|
+
rhs = pd.DataFrame(data={1054}, index={datetime.date(2010, 12, 31)})
|
30
|
+
|
31
|
+
lfs * rhs.values
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
結果----------------------------------------------------------------------
|
36
|
+
|
37
|
+
0
|
38
|
+
|
39
|
+
AAA 549.722132
|
40
|
+
|
19
|
-
|
41
|
+
BBB 91.548332
|
42
|
+
|
43
|
+
CCC 367.576176
|
44
|
+
|
45
|
+
DDD 45.154414
|
20
46
|
|
21
47
|
```
|
22
48
|
|
@@ -24,9 +50,23 @@
|
|
24
50
|
|
25
51
|
### 試したこと
|
26
52
|
|
27
|
-
re
|
53
|
+
merge = lfs * rhs.values
|
28
54
|
|
29
|
-
re
|
55
|
+
merge.columns = rhs.index
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
結果------------------------------------------------
|
60
|
+
|
61
|
+
2010-12-31
|
62
|
+
|
63
|
+
AAA 549.722132
|
64
|
+
|
65
|
+
BBB 91.548332
|
66
|
+
|
67
|
+
CCC 367.576176
|
68
|
+
|
69
|
+
DDD 45.154414
|
30
70
|
|
31
71
|
とすれば目的は達成できるのですが、もう少しスマートな方法はないでしょうか?
|
32
72
|
|