Question 1. Generate a 6x6 NumPy array with random integers between 0 and 100. Find the maximum value in each row and replace it with the string "MAX".
Question 2. Create a NumPy array with the elements ["cat", "dog", "bird", "cat", "dog", "fish"] and then count the occurrences of each unique element.
Question 3. Define a NumPy array containing the numbers 1 through 12 and reshape it into a 3x4 array. Calculate the standard deviation of each column.
Question 4. Generate a 4x4 NumPy array with random integers between -50 and 50. Replace all negative values with 0 and all positive values with 1.
Question 5. Create a NumPy array with the elements ["apple", "banana", "cherry", "apple", "banana"]. Remove duplicates from the array.
Question 6. Define a NumPy array containing the numbers 1 through 16 and reshape it into a 4x4 array. Extract the elements in the last column.
Question 7. Generate a 5x5 NumPy array with random floating-point numbers between 0 and 1. Round each element to the nearest integer.
Question 8. Create a NumPy array with the elements ["red", "green", "blue", "red", "green", "blue"]. Replace "red" with "orange".
Question 9. Define a NumPy array containing the numbers 1 through 20 and reshape it into a 5x4 array. Compute the sum of each column.
Question 10. Generate a 3x3 NumPy array with random integers between 1 and 100. Find the index of the maximum value in the array.
Leave a comment
You must be logged in to post a comment.