Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions