About 101,000 results
Open links in new tab
  1. python - 2D array indexing - Stack Overflow

    May 6, 2013 · a temporary array of shape (6,2,3) with values b[a] is created, then the assignment is performed. Since 10 is a constant, this assignment places the value 10 at each location in …

  2. How do you do two dimensional (x,y) indexing in Python?

    Mar 1, 2013 · The key is to understand how Python does indexing - it calls the __getitem__ method of an object when you try to index it with square brackets []. Thanks to this answer for …

  3. python - numpy - 2d array indexing - Stack Overflow

    I want to index the array using the geometrically oriented-convention a[x][y], as in x-axis and y-axis. How can I change the indexing order without modifying the array's shape so that a[0][1] …

  4. python - NumPy array indexing a 2D matrix - Stack Overflow

    Jun 27, 2013 · sounds reasonable. However, NumPy array indexing works differently: It still treats all those indices in a 1D fashion, but returns the values from the vector in the same shape as …

  5. python - Indexing NumPy 2D array with another 2D array - Stack …

    Since the title is referring to indexing a 2D array with another 2D array, the actual general numpy solution can be found here. In short: A 2D array of indices of shape (n,m) with arbitrary large …

  6. python - Numpy: How to index 2d array with 1d array? - Stack …

    Mar 7, 2019 · Is there any way to get by this without arange? It seems counterintuitive to me that something like a[idx.reshape(-1,1)] or a[:,idx] would not produce this result.

  7. python - How to index using through 2d arrays? - Stack Overflow

    Oct 27, 2021 · Can someone please explain to me how numpy indexing works for 2d arrays. I am finding it difficult to wrap my head around. Specifically, if i create a 2d 8x8 array, what would …

  8. python - How to define a two-dimensional array? - Stack Overflow

    Jul 12, 2011 · I want to define a two-dimensional array without an initialized length like this: Matrix = [][] But this gives an error: IndexError: list index out of range

  9. How to use a linear index to access a 2D array in Python

    You can convert your matrix to a numpy array and then use unravel_index to convert your linear indices into subscripts which you can then use to index into your original matrix. Note that all …

  10. Why doesn't the Python 2D array index order matter when used …

    Jan 21, 2015 · There is no 2D indexing going on at any point, Python doesn't have 2D indexing (although numpy has hacks that make it work like there is actual 2D indexing going on).

Refresh