Ravi Vishwakarma is a dedicated Software Developer with a passion for crafting efficient and innovative solutions. With a keen eye for detail and years of experience, he excels in developing robust software systems that meet client needs. His expertise spans across multiple programming languages and technologies, making him a valuable asset in any software development project.
ICSM Computer
05-Nov-20251. Basic Indexing
Just like Python lists:
2. 2D Array Indexing
Use
[row, column]:You can also access entire rows or columns:
3. Slicing
You can extract a range of elements:
For 2D arrays:
4. Integer (Fancy) Indexing
Use lists or arrays of indices:
For 2D arrays:
Explanation:
(0,1)and(2,0)are the chosen coordinates.5. Boolean Indexing
Select elements that satisfy a condition:
You can also combine conditions:
For 2D arrays:
6. Assigning Values
You can modify elements directly:
Boolean assignment:
7. Using
np.i()for Multi-dimensional SelectionIf you want to select specific rows and columns:
Summary Table
arr[2]arr[1, 2]arr[1:4]arr[[0,2,4]]arr[arr > 5]