About 8,450,000 results
Open links in new tab
  1. How to select a portion of a NumPy array efficiently?

    For your example, this means import numpy as np x = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]) # array([[ 1, 2, 3, 4], # [ 5, 6, 7, 8], # [ 9, 10, 11, 12]]) x[1:3, 0:2] # => array([[ 5, 6], # [ 9, 10]])

    Missing:

    • Center

    Must include:

  2. python - Numpy: how to take some part of a matrix - Stack Overflow

    Dec 13, 2018 · I have to take only some parts/subset of a matrix that has 1273x1273 dimension. I have two indices = {i,j}, and I have to take the elements of a matrix that have i as index of row, …

    Missing:

    • Center

    Must include:

  3. python - Center crop a numpy array - Stack Overflow

    Apr 18, 2017 · I am trying to crop a numpy array [width x height x color] to a predefined smaller dimension. I found something that should do what I want but it works only for [width x height] …

  4. Extracting part of a vector or matrix - University of Utah

    To extract a range of values, use the subscript range [j:k]. You get the values from j j+1 k-1. Note that it stops just before k. A colon : by itself specifies all values. Of course, this is not needed …

    Missing:

    • Center

    Must include:

  5. numpy.takeNumPy v2.2 Manual

    numpy.take # numpy.take(a, indices, axis=None, out=None, mode='raise') [source] # Take elements from an array along an axis. When axis is not None, this function does the same …

    Missing:

    • Center

    Must include:

  6. NumPy Array Slicing: Extract Submatrices in Python

    Apr 26, 2025 · This advanced technique allows you to create a "view" of the original array without actually copying the data. It's particularly useful for extracting overlapping submatrices or for …

    Missing:

    • Center

    Must include:

  7. NumPy Array Slicing - W3Schools

    import numpy as np arr = np.array ( [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) print(arr [0:2, 2])

  8. numpy.matrixNumPy v2.2 Manual

    Returns a matrix from an array-like object, or from a string of data. A matrix is a specialized 2-D array that retains its 2-D nature through operations. It has certain special operators, such as * …

    Missing:

    • Center

    Must include:

  9. Array manipulation routines — NumPy v2.2 Manual

    Interpret the input as a matrix. Return an array (ndim >= 1) laid out in Fortran order in memory. Return a contiguous array (ndim >= 1) in memory (C order). Return an ndarray of the provided …

    Missing:

    • Center

    Must include:

  10. python - What is a fast (er) way to get the center points of …

    Nov 17, 2021 · An alternative method is to ask Numpy to return the index in the unique call so that you can then accumulate the value regarding the object (like a reduce-by-key where the …

Refresh