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).
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?
Step by Step Solution
3.45 Rating (152 Votes )
There are 3 Steps involved in it
Step: 1
import numpy as np 11 Create a 5x4 array with random integers between 1 and 100 arr nprandomrandint1 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started