Hi,
In the following test case, i'm looking for a way to extract rows from a 3D array, but i want that the results remains a 3D array; in otherway, i want to extract a part of the 3D array
Obviously:
In the following test case, i'm looking for a way to extract rows from a 3D array, but i want that the results remains a 3D array; in otherway, i want to extract a part of the 3D array
Obviously:
- here there's a single row per subarray but in the "real life" the number of rows differs from a study to another
- i'm sure that the number of rows remains identical per subarray => that's why a 3D array is possible
- prior to play with "reshape" (with also depends on the block size), i'm wondering if something ever exist in numpy (without using a loop)
import numpy as np
M = np.array([[[ 6, 9, 4],
[ 0, 2, 1],
[10, 15, 30]],
[[ 9, 0, 1],
[ 4, 6, 4],
[ 0, 3, 9]],
[[ 6, 7, 4],
[ 0, 1, 6],
[ 1, 5, 1]]])
index = np.where(np.isin(M[:, :, 0], 0))
print(index)
Mprime = M[index]
