質問するログイン新規登録

回答編集履歴

1

修正

2020/09/28 17:03

投稿

tiitoi
tiitoi

スコア21962

answer CHANGED
@@ -6,13 +6,17 @@
6
6
 
7
7
  a = np.array([[1],
8
8
  [0],
9
+ [0],
9
10
  [4],
10
11
  [0]])
11
12
 
12
13
  rows, cols = np.where(a == 0)
14
+ print(rows) # [1 2 4]
15
+ print(cols) # [0 0 0]
13
16
 
14
17
  for row, col in zip(rows, cols):
15
18
  print((row, col))
16
19
  # (1, 0)
17
- # (3, 0)
20
+ # (2, 0)
21
+ # (4, 0)
18
22
  ```