回答編集履歴
1
追記
answer
CHANGED
@@ -8,4 +8,12 @@
|
|
8
8
|
return np.sqrt(obj.R3/a3)* t
|
9
9
|
AttributeError: 'float' object has no attribute 'sqrt'
|
10
10
|
```
|
11
|
-
にて`AttributeError`が発生しています。
|
11
|
+
にて`AttributeError`が発生しています。
|
12
|
+
例えば以下のケース(objectに対して操作)で発生しえます。
|
13
|
+
```Python
|
14
|
+
import numpy as np
|
15
|
+
a = np.array([4.0],dtype=object)
|
16
|
+
#ret = np.sqrt(a) # AttributeError: 'float' object has no attribute 'sqrt'
|
17
|
+
a = a.astype(float)
|
18
|
+
ret = np.sqrt(a) # OK
|
19
|
+
```
|