Build a 5X4 array with random integer between 1 and 100. The required arguments of the creation
Question:
Build a 5X4 array with random integer between 1 and 100. The required arguments of the creation function to do this is np.random.randint(low, high, size). As usual, low is inclusive and high is exclusive.
1.2 Change the element of second row/third column to 0
1.3 Create a slice of two rows and three columns (row 2 and 3, column 2-4). Your way of creation should guarantee that changing the slice will not change the original array. Change the element at row 2 and column 2 in the slice to 100. Print the slice before and after change.
1.4 Create a two-dimensional array with 5 integers in one row. You can create it your own way. Can this array and the one created in 1.1 be added together?
1.5 Following 1.4, how can we make the two arrays add together?
1.6 Multiply the elements (in the 5X4 array created in 1.1) that are divisable by 3 with 2.
1.7 Calculate the mean and the standard deviation of each column using aggregation functions of the array from 1.1. Use the mean and std to get the standardized value of each element using the formula: (x - mean)/std, where x is the element. Tips: Which axis should we use?
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss