N-D indexing with defaults in NumPy
N-D indexing with defaults in NumPy Question: Can I index NumPy N-D array with fallback to default values for out-of-bounds indexes? Example code below for some imaginary np.get_with_default(a, indexes, default): import numpy as np print(np.get_with_default( np.array([[1,2,3],[4,5,6]]), # N-D array [(np.array([0, 0, 1, 1, 2, 2]), np.array([1, 2, 2, 3, 3, 5]))], # N-tuple of indexes …
Total answers: 3