Numpy-question

Level: Intermediate

1. How do you create a NumPy array with evenly spaced values within a specified interval, but exclude the endpoint?
2. How do you reverse the order of elements in a NumPy array?
3. How can you find the indices of all occurrences of a value in a NumPy array?
4. How do you reshape a 1D array into a 3D array?
5. How can you add a new axis to a NumPy array?
6. How do you remove single-dimensional entries from the shape of an array?
7. How do you repeat elements of a NumPy array?
8. How can you tile a NumPy array?
9. How do you broadcast two arrays to a common shape for arithmetic operations?
10. How can you compare two NumPy arrays element-wise?
11. How do you compute the cumulative sum of elements in a NumPy array?
12. How do you compute the cumulative product of elements in a NumPy array?
13. How can you calculate the moving average of elements in a NumPy array?
14. How do you find the unique rows in a 2D NumPy array?
15. How do you find the unique columns in a 2D NumPy array?
16. How do you calculate the inner product of two NumPy arrays?
17. How do you calculate the outer product of two NumPy arrays?
18. How can you compute the matrix product of two 2D NumPy arrays?
19. How do you perform element-wise comparison of two NumPy arrays and return the result as a boolean array?
20. How can you create a masked array from a NumPy array?
21. How do you fill the masked elements in a masked array?
22. How do you compute the correlation coefficient of two NumPy arrays?
23. How do you compute the covariance matrix of a NumPy array?
24. How do you sort a 2D NumPy array by a specific column?
25. How do you sort a 2D NumPy array by a specific row?
26. How can you get the indices of the sorted elements in a NumPy array?
27. How do you find the k largest values in a NumPy array?
28. How do you find the k smallest values in a NumPy array?
29. How can you stack multiple NumPy arrays along a new axis?
30. How do you compute the dot product of two 2D arrays along a specific axis?
31. How can you swap two axes of a NumPy array?
32. How do you rotate a NumPy array by 90 degrees?
33. How do you flip a NumPy array upside down?
34. How do you flip a NumPy array left to right?
35. How can you generate a random permutation of a NumPy array?
36. How do you shuffle the rows of a 2D NumPy array?
37. How do you shuffle the columns of a 2D NumPy array?
38. How do you randomly sample elements from a NumPy array?
39. How do you normalize a NumPy array so that its values lie between 0 and 1?
40. How do you standardize a NumPy array so that it has a mean of 0 and a standard deviation of 1?
41. How do you calculate the Frobenius norm of a NumPy array?
42. How do you calculate the Euclidean distance between two NumPy arrays?
43. How do you find the indices of non-zero elements in a NumPy array?
44. How do you replace all occurrences of a specific value in a NumPy array with another value?
45. How can you create a structured array in NumPy with multiple data types?
46. How do you access the fields of a structured array?
47. How do you apply a function to each element in a NumPy array?
48. How do you vectorize a function to apply it to NumPy arrays element-wise?
49. How do you compute the histogram of a NumPy array?
50. How can you find the peaks (local maxima) in a NumPy array?

Beginner Level: View

Advanced Level: View