About 281,000 results
Open links in new tab
  1. numpy - Python 3D Array Indexing - Stack Overflow

    Jun 12, 2021 · B = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) print(B[0,1,0]) This returns the value of 3. But my expectation is that it should return 2 because it is the first row, second column, first …

  2. Numpy: Index 3D array with index of last axis stored in 2D array

    Jun 3, 2024 · In this article, we have demonstrated how to index a 3D NumPy array using indices stored in a 2D array. This technique leverages the numpy.take_along_axis function to …

  3. Indexing Multi-dimensional arrays in Python using NumPy

    Apr 25, 2025 · To index a multi-dimensional array you can index with a slicing operation similar to a single dimension array. Python3 import numpy as np arr_m = np . arange ( 12 ) . reshape ( 2 …

  4. python - Looking up index of value in numpy 3D arrays - Stack Overflow

    Sep 1, 2018 · For each grid cell in arr_idx, I want to look up the Z-position of the value closest to it in arr_keys (but with the same X, Y location) and return the value at the corresponding position …

  5. 3D Arrays in Python using NumPy - Python Guides

    May 15, 2025 · Learn how to work with 3D arrays in Python using NumPy. This comprehensive guide covers creation methods, indexing, slicing, and applications like image processing

  6. Indexing on ndarrays — NumPy v2.2 Manual

    ndarrays can be indexed using the standard Python x[obj] syntax, where x is the array and obj the selection. There are different kinds of indexing available depending on obj: basic indexing, …

  7. Python Array Indexing - GeeksforGeeks

    Dec 8, 2024 · 3D Array Indexing In a 3D array, elements are arranged in 2D grids and those grids are nested inside another array. You can access an element using three indices: one for the …

  8. Indexing and Slicing of 1D, 2D and 3D Arrays Using Numpy

    Apr 9, 2020 · Array indexing and slicing is most important when we work with a subset of an array. This article will be started with the basics and eventually will explain some advanced …

  9. Array Indexing in Python - Beginner's Reference - AskPython

    Jan 31, 2021 · Indexing 3D Arrays in Python. Following is the general syntax for accessing elements from a 3D array using index.

  10. python - Numpy 3d array indexing - Stack Overflow

    Mar 15, 2017 · import numpy as np np.random.seed(77) data=np.random.randint(low=0, high=10, size=(5, 7, 2)) indices = np.array([0, 1, 6, 4, 5]) #how can I select indices from the data array? …

  11. Some results have been removed