D
D
Daniil Shevkunov2021-06-10 20:08:45
Python
Daniil Shevkunov, 2021-06-10 20:08:45

How to get the index of the string in which there is a number 2 from a two-dimensional numpy array without a loop?

there is an array like

a = np.array()


How to get the index of a string that has the number 2 without a loop?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aRegius, 2021-06-10
@danila763

np.argwhere(a==2)[:, 0]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question