質問編集履歴
6
あああ
test
CHANGED
File without changes
|
test
CHANGED
@@ -100,6 +100,8 @@
|
|
100
100
|
|
101
101
|
#参考にしたもの
|
102
102
|
|
103
|
+
**np.vectorize**を用いてみましたが同じエラー文がでます
|
104
|
+
|
103
105
|
```python
|
104
106
|
|
105
107
|
# PYTHON_NUMPY_FROMPYFUNC
|
5
aaa
test
CHANGED
File without changes
|
test
CHANGED
@@ -100,6 +100,38 @@
|
|
100
100
|
|
101
101
|
#参考にしたもの
|
102
102
|
|
103
|
+
```python
|
104
|
+
|
105
|
+
# PYTHON_NUMPY_FROMPYFUNC
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
import numpy as np
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
# binをユニバーサル関数に変換
|
114
|
+
|
115
|
+
ubin = np.frompyfunc(bin, 1, 1)
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
# 配列を用意
|
120
|
+
|
121
|
+
num = np.array([1, 2, 3, 4, 5])
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
# numの要素を2進数表記に変換
|
126
|
+
|
127
|
+
x = ubin(num)
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
print(x)
|
132
|
+
|
133
|
+
```
|
134
|
+
|
103
135
|
下記のコードは特に軸とか選択してないと思うのですがlistだから動くのでしょうか?
|
104
136
|
|
105
137
|
```python
|
4
, → .
test
CHANGED
File without changes
|
test
CHANGED
@@ -58,7 +58,7 @@
|
|
58
58
|
|
59
59
|
|
60
60
|
|
61
|
-
def calc_test(self
|
61
|
+
def calc_test(self, array_in):
|
62
62
|
|
63
63
|
何かしらの計算
|
64
64
|
|
3
書き忘れていたselfを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -58,7 +58,7 @@
|
|
58
58
|
|
59
59
|
|
60
60
|
|
61
|
-
def calc_test(array_in):
|
61
|
+
def calc_test(self.array_in):
|
62
62
|
|
63
63
|
何かしらの計算
|
64
64
|
|
2
特になし
test
CHANGED
File without changes
|
test
CHANGED
@@ -86,6 +86,16 @@
|
|
86
86
|
|
87
87
|
axis -1 is out of bounds for array of dimension 0
|
88
88
|
|
89
|
+
**詳細**
|
90
|
+
|
91
|
+
989 else:
|
92
|
+
|
93
|
+
990 a = asanyarray(a).copy(order="K")
|
94
|
+
|
95
|
+
--> 991 a.sort(axis=axis, kind=kind, order=order)
|
96
|
+
|
97
|
+
992 return a
|
98
|
+
|
89
99
|
|
90
100
|
|
91
101
|
#参考にしたもの
|
1
np.frompyfuncの代入先をcalc→calcFに変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -70,9 +70,9 @@
|
|
70
70
|
|
71
71
|
|
72
72
|
|
73
|
-
calc = np.frompyfunc(calc.calc_test, 1, 1)
|
73
|
+
calcF = np.frompyfunc(calc.calc_test, 1, 1)
|
74
74
|
|
75
|
-
ndarray_out = calc(ndarray_out)
|
75
|
+
ndarray_out = calcF(ndarray_out)
|
76
76
|
|
77
77
|
|
78
78
|
|