About 178,000 results
Open links in new tab
  1. How do I extract a sub-array from a numpy 2d array?

    Feb 28, 2016 · Slicing arrays in Numpy / Scipy (3 answers) Closed 9 years ago . I'd like to extract a numpy array with a specified size from a numpy 2d array--essentially I want to crop the array.

  2. extracting a subarray from an array in python using numpy

    Oct 10, 2017 · Numpy allows you to splice within a single statement, like this: room_matrix[1:3, 1:3] #will slice rows starting from 1 to 2 (row numbers start at 0), likewise for columns Share

  3. numpy - How to get a sub-array in python? - Stack Overflow

    So I have an array, and I'm trying to get a sub-array from it. x = np.arange(0,100).reshape((10, 10)) array([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15 ...

  4. arrays - Python/Numpy subarray selection - Stack Overflow

    5 days ago · Python/Numpy subarray selection. Ask Question Asked 10 years, 3 months ago. Modified 10 years, 3 months ago.

  5. sub array - How to get a subarray in numpy - Stack Overflow

    May 7, 2015 · You can create numpy arrays for indexing into different dimensions of the 3D array and then use use ix_ function to create indexing map and thus get the sliced output. The benefit with ix_ is that it allows for broadcasted indexing maps.

  6. python - Replace subarrays in numpy - Stack Overflow

    Jun 5, 2012 · numpy.where works by selecting from the second argument if true and the third argument if false. You can use where to select from 3 different types of data. The first is an array that has the same shape as selected_indices, the second is just a value on its own (like 2 or 7).

  7. Python/NumPy first occurrence of subarray - Stack Overflow

    Aug 18, 2011 · Python/NumPy first occurrence of subarray. Ask Question Asked 13 years, 8 months ago.

  8. python - Numpy extract submatrix - Stack Overflow

    Oct 3, 2013 · I'm pretty new in numpy and I am having a hard time understanding how to extract from a np.array a sub matrix with defined columns and rows: Y = np.arange(16).reshape(4,4) If I want to extract columns/rows 0 and 3, I should have:

  9. Numpy sub-array assignment with advanced, mixed indexing

    This is how numpy is designed to work, but it is nevertheless a bit confusing that x[0][:, I] is not the ...

  10. Numpy sum of values in subarrays between pairs of indices

    Aug 28, 2013 · Assuming your index pairs are stored in a NumPy array indices of shape (n, 2) and n is fairly large, ...

Refresh