A
Alexzive
Hello there,
let's suppose I have the following matrix:
mat = [[1,2,3], [3,2,4], [7,8,9], [6,2,9]]
where [.. , .. , ..] are the rows.
I am interested into getting the "row index" of all the matrix rows
where a certain number occurs.
For example for 9 I should get 2 and 3 (starting from 0).
For 10 I should get an error msg (item not found) and handle it.
How to get the"row indexes" of found items?
In practice I am looking for an equivalent to "list.index(x)" for the
case "lists of lists"
Many Thanks!
Alex
PS: this is just a simplified example, but I have actually to deal
with large matrices [~500000 * 4]
let's suppose I have the following matrix:
mat = [[1,2,3], [3,2,4], [7,8,9], [6,2,9]]
where [.. , .. , ..] are the rows.
I am interested into getting the "row index" of all the matrix rows
where a certain number occurs.
For example for 9 I should get 2 and 3 (starting from 0).
For 10 I should get an error msg (item not found) and handle it.
How to get the"row indexes" of found items?
In practice I am looking for an equivalent to "list.index(x)" for the
case "lists of lists"
Many Thanks!
Alex
PS: this is just a simplified example, but I have actually to deal
with large matrices [~500000 * 4]