Question: LAB 6 NDARRAY in python Write short scripts to create and use numpy arrays. Write each program in a separate cell or cells. Create a

LAB 6 NDARRAY in python

Write short scripts to create and use numpy arrays. Write each program in a separate cell or cells.

  1. Create a numpy array variable A using np.ndarray function. Specify the array shape to be 5x20 and load it with a sequence of floating point numbers from 0 to 100. After creating A, show its contents, object type, data type, shape, and flags. Notice if the array data is stored I row or column major order.
  2. Reshape the array A into a new array B with shape 10x10 and print its contents.
  3. Print the element values in row 3 of array B.
  4. Print the element values in row 3 of array B in reverse order.
  5. Replace the elements of column 5 of array A with their square root and print the array A.
  6. Create a matrix of shape 100x100 of random integers in the interval [-1,2). Sum each row of values and plot a bar graph of the values. (You have just created a 1D random walk of 100 walkers each taking 100 steps).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!