質問編集履歴
3
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,23 @@
|
|
12
12
|
|
13
13
|
print(X)
|
14
14
|
|
15
|
+
---------------------------------------------------------------------
|
16
|
+
|
17
|
+
ValueError Traceback (most recent call last)
|
18
|
+
|
19
|
+
<ipython-input-54-f100f202c587> in <module>()
|
20
|
+
|
21
|
+
2 for y in range(9):
|
22
|
+
|
23
|
+
3 num_list.append(y)
|
24
|
+
|
25
|
+
----> 4 X = np.array([num_list]).reshape(3, 3)
|
26
|
+
|
27
|
+
5 print(X)
|
28
|
+
|
29
|
+
|
30
|
+
|
15
|
-
|
31
|
+
ValueError: cannot reshape array of size 1 into shape (3,3)
|
16
32
|
|
17
33
|
```
|
18
34
|
|
2
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,9 +12,9 @@
|
|
12
12
|
|
13
13
|
print(X)
|
14
14
|
|
15
|
+
#cannot reshape array of size 1 into shape (3,3)
|
16
|
+
|
15
17
|
```
|
16
|
-
|
17
|
-
cannot reshape array of size 1 into shape (3,3)
|
18
18
|
|
19
19
|
とエラーが発生します。しかし
|
20
20
|
|
@@ -30,15 +30,13 @@
|
|
30
30
|
|
31
31
|
print(X.reshape(3, 3))
|
32
32
|
|
33
|
+
#[[0 1 2]
|
34
|
+
|
35
|
+
[3 4 5]
|
36
|
+
|
37
|
+
[6 7 8]]
|
38
|
+
|
33
39
|
```
|
34
|
-
|
35
|
-
だと
|
36
|
-
|
37
|
-
[[0 1 2]
|
38
|
-
|
39
|
-
[3 4 5]
|
40
|
-
|
41
|
-
[6 7 8]]
|
42
40
|
|
43
41
|
となります。
|
44
42
|
|
1
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
```python
|
2
|
+
|
1
3
|
num_list =[]
|
2
4
|
|
3
5
|
for y in range(9):
|
@@ -10,11 +12,13 @@
|
|
10
12
|
|
11
13
|
print(X)
|
12
14
|
|
13
|
-
|
15
|
+
```
|
14
16
|
|
15
17
|
cannot reshape array of size 1 into shape (3,3)
|
16
18
|
|
17
19
|
とエラーが発生します。しかし
|
20
|
+
|
21
|
+
```python
|
18
22
|
|
19
23
|
num_list =[]
|
20
24
|
|
@@ -25,6 +29,8 @@
|
|
25
29
|
X = np.array([num_list])
|
26
30
|
|
27
31
|
print(X.reshape(3, 3))
|
32
|
+
|
33
|
+
```
|
28
34
|
|
29
35
|
だと
|
30
36
|
|