回答編集履歴

2

Delete

2022/09/25 06:25

投稿

melian
melian

スコア19840

test CHANGED
@@ -1,21 +1,3 @@
1
- [numpy.put — NumPy v1.23 Manual](https://numpy.org/doc/stable/reference/generated/numpy.put.html)
2
- > The indexing works on the flattened target array. put is roughly equivalent to:
3
- >
1
+ ※          
4
- > `a.flat[ind] = v`
5
2
 
6
- ```python
7
- import numpy as np
8
3
 
9
- # [[1 1 1]
10
- # [1 1 1]
11
- # [1 1 1]]
12
- array = np.ones((3, 3), dtype = np.int32)
13
-
14
- array.flat[::2] = 34
15
- print(array)
16
-
17
- #
18
- [[34 1 34]
19
- [ 1 34 1]
20
- [34 1 34]]
21
- ```

1

Update

2022/09/24 23:46

投稿

melian
melian

スコア19840

test CHANGED
@@ -4,7 +4,14 @@
4
4
  > `a.flat[ind] = v`
5
5
 
6
6
  ```python
7
+ import numpy as np
8
+
9
+ # [[1 1 1]
10
+ # [1 1 1]
11
+ # [1 1 1]]
12
+ array = np.ones((3, 3), dtype = np.int32)
13
+
7
- array.flat[[0, 2, 4, 6, 8]] = 34
14
+ array.flat[::2] = 34
8
15
  print(array)
9
16
 
10
17
  #