Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
31 views1 page

Assignment 1

Uploaded by

01fe22bcs196
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views1 page

Assignment 1

Uploaded by

01fe22bcs196
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Exercise On Numpy

A=[34,56,234,1,2,8]

For the above list create a numpy array


Calculate mean using suitable Numpy Function Create a 0-D array with
value 42
Create a 1-D array containing the values 1,2,3,4,5: Create a 2-D array containing two
arrays with the values 1,2,3 and 4,5,6: Get third and fourth elements from the given array
and add them. Create Array with these elements :([[1,2,3,4,5],
[6,7,8,9,10],[0,3,8,0,5])
Randomly constructing 1D array using numpy.random.rand function

Access the element on the first row, second column: Print the last
element from the 2nd dim:
Slice elements from the beginning to index 4 Slice from the index 3 from the
end to index 1 from the end: Return every other element from index 1 to
index 5: Return every other element from the entire array:
From the second element, slice elements from index 1 to index 4 Create the 1-D array
with 12 elements using range function Convert the 1-D array with 12 elements into a
2-D array. Convert the above 2D array to 1-dimensional array Split the array in 3 parts:
Join two arrays : arr1 = np.array([1, 2, 3]),arr2 = np.array([4, 5, 6])For the
Given array A, Find the indexes where the value is 234: Display all even index elements
from array A using arange function Display all odd index elements from arrays A using
linspace function

You might also like