Answered step by step
Verified Expert Solution
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.
- 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.
- Reshape the array A into a new array B with shape 10x10 and print its contents.
- Print the element values in row 3 of array B.
- Print the element values in row 3 of array B in reverse order.
- Replace the elements of column 5 of array A with their square root and print the array A.
- 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
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