GeeksforGeeks
geeksforgeeks.org โบ python โบ numpy-indexing
Numpy Array Indexing - GeeksforGeeks
December 17, 2025 - A 1D NumPy array is a sequence of values with positions called indices which starts at 0. We access elements by using these indices in square brackets like arr[0] for the first element.
09:07
NumPy Indexing & Slicing Explained with Examples - YouTube
07:13
4: Indexing and slicing NumPy arrays - YouTube
09:33
Numpy Array Indexing - YouTube
13:09
NumPy Tutorial #2: Indexing and Slicing - YouTube
09:46
NumPy Array Indexing | Array Indexing in NumPy - YouTube
06:42
Advanced Indexing Techniques on NumPy Arrays - Learn NumPy Series ...
NumPy
numpy.org โบ doc โบ stable โบ user โบ basics.indexing.html
Indexing on ndarrays โ NumPy v2.5 Manual
The simplest case of indexing with N integers returns an array scalar representing the corresponding item. As in Python, all indices are zero-based: for the i-th index \(n_i\), the valid range is \(0 \le n_i < d_i\) where \(d_i\) is the i-th element of the shape of the array.
NumPy
numpy.org โบ doc โบ 1.21 โบ reference โบ arrays.indexing.html
Indexing โ NumPy v1.21 Manual
June 22, 2021 - ndarrays can be indexed using the standard Python x[obj] syntax, where x is the array and obj the selection. There are three kinds of indexing available: field access, basic slicing, advanced indexing. Which one occurs depends on obj. ... In Python, x[(exp1, exp2, ..., expN)] is equivalent ...
NumPy
numpy.org โบ devdocs โบ user โบ basics.indexing.html
Indexing on ndarrays โ NumPy v2.6.dev0 Manual
The simplest case of indexing with N integers returns an array scalar representing the corresponding item. As in Python, all indices are zero-based: for the i-th index \(n_i\), the valid range is \(0 \le n_i < d_i\) where \(d_i\) is the i-th element of the shape of the array.
Programiz
programiz.com โบ python-programming โบ numpy โบ array-indexing
Numpy Array Indexing (With Examples)
In NumPy, we can access specific rows or columns of a 2-D array using array indexing.
Python Like You Mean It
pythonlikeyoumeanit.com โบ Module3_IntroducingNumpy โบ BasicIndexing.html
Introducing Basic and Advanced Indexing โ Python Like You Mean It
Thus far we have seen that we can access the contents of a NumPy array by specifying an integer or slice-object as an index for each one of its dimensions. Indexing into and slicing along the dimensions of an array are known as basic indexing.
DataCamp
datacamp.com โบ doc โบ numpy โบ array-indexing
NumPy Array Indexing
It is essential for tasks like data slicing, filtering, and transformation, and can be performed using integer, boolean, or slice indices. import numpy as np # Basic syntax array[index] array[start:stop:step]
TutorialsPoint
tutorialspoint.com โบ numpy โบ numpy_indexing_and_slicing.htm
NumPy - Indexing & Slicing
Contents of ndarray object can be accessed and modified by indexing or slicing, just like Python's in-built container objects. NumPy Indexing is used to access or modify elements in an array.
TutorialsPoint
tutorialspoint.com โบ numpy โบ numpy_advanced_indexing.htm
NumPy - Advanced Indexing
Advanced indexing offers a robust method to select specific elements from a NumPy array based on predetermined conditions or guidelines. It allows you to select elements from an ndarray that is a non-tuple sequence, ndarray object of integer or
NumPy
numpy.org โบ doc โบ 1.16 โบ reference โบ arrays.indexing.html
Indexing โ NumPy v1.16 Manual
February 18, 2020 - ndarrays can be indexed using the standard Python x[obj] syntax, where x is the array and obj the selection. There are three kinds of indexing available: field access, basic slicing, advanced indexing. Which one occurs depends on obj. ... In Python, x[(exp1, exp2, ..., expN)] is equivalent ...
NumPy
numpy.org โบ doc โบ 2.2 โบ user โบ basics.indexing.html
Indexing on ndarrays โ NumPy v2.2 Manual
The simplest case of indexing with N integers returns an array scalar representing the corresponding item. As in Python, all indices are zero-based: for the i-th index \(n_i\), the valid range is \(0 \le n_i < d_i\) where \(d_i\) is the i-th element of the shape of the array.
NumPy
numpy.org โบ devdocs โบ user โบ how-to-index.html
How to index ndarrays โ NumPy v2.6.dev0 Manual
It must be kept in mind that basic indexing produces views and advanced indexing produces copies, which are computationally less efficient.
Quansight-labs
quansight-labs.github.io โบ ndindex โบ indexing-guide โบ index.html
Guide to NumPy Indexing - ndindex documentation
These indices will not work on the built-in Python sequence types like list and str; they are only defined for NumPy arrays. This section is itself split into six subsections. First is a basic introduction to what a NumPy array is. Following this are pages for each of the remaining index types, the basic indices: tuples, ellipses, and newaxis; and the advanced indices: integer arrays and boolean arrays (i.e., masks).
Scaler
scaler.com โบ home โบ topics โบ numpy โบ indexing and slicing numpy arrays
Indexing and Slicing NumPy Arrays - Scaler Topics
May 4, 2023 - Let's see in the following table how slicing is different from indexing in Python. Indexing is used for accessing a specific element from an array, and for obtaining a subtuple, substring, or sublist from a tuple, string, or list, slicing is used. By Slicing the NumPy array, we get a specific ...
GeeksforGeeks
geeksforgeeks.org โบ python โบ numpy-slicing-and-indexing
Basic Slicing and Advanced Indexing in NumPy - GeeksforGeeks
Indexing with index arrays lets you fetch multiple elements from a NumPy array at once using their index positions. Unlike slicing, it returns a new copy of the data. Example: Here, we create an array in decreasing order and use another array ...
Published: November 4, 2025
NumPy
numpy.org โบ doc โบ 2.3 โบ user โบ basics.indexing.html
Indexing on ndarrays โ NumPy v2.3 Manual
The simplest case of indexing with N integers returns an array scalar representing the corresponding item. As in Python, all indices are zero-based: for the i-th index \(n_i\), the valid range is \(0 \le n_i < d_i\) where \(d_i\) is the i-th element of the shape of the array.
Top answer 1 of 6
200
Use np.where to get the indices where a given condition is True.
Examples:
For a 2D np.ndarray called a:
i, j = np.where(a == value) # when comparing arrays of integers
i, j = np.where(np.isclose(a, value)) # when comparing floating-point arrays
For a 1D array:
i, = np.where(a == value) # integers
i, = np.where(np.isclose(a, value)) # floating-point
Note that this also works for conditions like >=, <=, != and so forth...
You can also create a subclass of np.ndarray with an index() method:
class myarray(np.ndarray):
def __new__(cls, *args, **kwargs):
return np.array(*args, **kwargs).view(myarray)
def index(self, value):
return np.where(self == value)
Testing:
a = myarray([1,2,3,4,4,4,5,6,4,4,4])
a.index(4)
#(array([ 3, 4, 5, 8, 9, 10]),)
2 of 6
34
You can convert a numpy array to list and get its index .
for example:
tmp = [1,2,3,4,5] #python list
a = numpy.array(tmp) #numpy array
i = list(a).index(2) # i will return index of 2, which is 1
this is just what you wanted.