NumPy Interview Questions and Answers
Ques 16. How to access elements from a 2D NumPy array?
You can use indices. For example, 'arr[1, 2]' accesses the element in the second row and third column of 'arr'.
Is it helpful?
Add Comment
View Comments
Ques 17. Explain the concept of a NumPy universal function (ufunc).
A ufunc in NumPy is a flexible function that operates element-wise on NumPy arrays, supporting broadcasting.
Is it helpful?
Add Comment
View Comments
Ques 18. How to concatenate two NumPy arrays vertically?
You can use 'np.vstack()' or 'np.concatenate()' with 'axis=0'.
Is it helpful?
Add Comment
View Comments
Ques 19. What is the purpose of 'np.ravel()' in NumPy?
'np.ravel()' returns a flattened 1D array from a multi-dimensional array.
Is it helpful?
Add Comment
View Comments
Ques 20. Explain the use of 'np.histogram()' in NumPy.
'np.histogram()' computes the histogram of a set of data, returning the bin counts and bin edges.
Is it helpful?
Add Comment
View Comments
Most helpful rated by users:
- How to install NumPy?
- Create a NumPy array from a Python list.
- What is NumPy?
- What is the difference between 'np.zeros()' and 'np.ones()' in NumPy?
- What is the purpose of 'np.eye()' in NumPy?