回答編集履歴
1
追記
test
CHANGED
@@ -71,3 +71,39 @@
|
|
71
71
|
|
72
72
|
|
73
73
|
データのどこかに数値以外のデータがないか確認してください。
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
---
|
78
|
+
|
79
|
+
【追記】
|
80
|
+
|
81
|
+
```Python
|
82
|
+
|
83
|
+
print(df)
|
84
|
+
|
85
|
+
# 0.1 43.2 Unnamed: 2
|
86
|
+
|
87
|
+
#0 0.2 41.1 NaN
|
88
|
+
|
89
|
+
#1 0.3 38.7 NaN
|
90
|
+
|
91
|
+
#2 0.4 34.4 NaN
|
92
|
+
|
93
|
+
#3 0.5 29.9 NaN
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
print(df.apply(lambda x:x/sum(x)))
|
98
|
+
|
99
|
+
# 0.1 43.2 Unnamed: 2
|
100
|
+
|
101
|
+
#0 0.142857 0.285219 NaN
|
102
|
+
|
103
|
+
#1 0.214286 0.268563 NaN
|
104
|
+
|
105
|
+
#2 0.285714 0.238723 NaN
|
106
|
+
|
107
|
+
#3 0.357143 0.207495 NaN
|
108
|
+
|
109
|
+
```
|