Find the ith element of an array using NumPy

In this python numpy program, we will find the ith element of an array using NumPy.

Steps to solve the program
  1. Import the numpy library as np.
  2. Create an array using np.array().
  3. Find the ith element of an array using indexing and logic.
  4. Print the output.
				
					import numpy as np
x = np.array([[4,8,7],[2,3,6]])
print("Fifth element: ",x[1,1])
				
			

Output :

				
					Fifth element:  3
				
			

change the data type of an array.

remove single-dimensional entries from a specified shape.

Leave a Comment