BMS COLLEGE OF ENGINEERING, BANGALORE-19
(Autonomous College under VTU)
Department of Information Science & Engineering
ACADEMIC YEAR: Advanced Python SEMESTER: V
2022-23 Worksheet for NumPY Date:
Array Creation
Reference: https://numpy.org/doc/stable/reference/routines.array-creation.html
1. Create a Numpy array of 4 elements without initialization
2. Array of 5 with initilzation to 0
3. Get the following output
4. Get the following output
5. Create new empty array with the same shape and type as a given array
6. Get the following output
7. Get the following output
Obtain the following output
8. Obtain the following output
9. Create an array of ones with the same shape and type as a given array.
10. Create an Array with Zeros with custom data type
11. an array of zeros with the same shape and type as a given array.
12. a new array of given shape and type, filled with fill_value.
13. A full array with the same shape and type as a given array.
14. print first item of an array
16.print the number 8 from the array below:
arr = np.array([[1,2,3,4,5], [6,7,8,9,10]])
17. print the numbers [3, 4, 5] from the array below:
arr = np.array([1,2,3,4,5,6,7])
18. print the last 4 numbers from the array below:
arr = np.array([1,2,3,4,5,6,7])
19.print every other item from the array below:
arr = np.array([1,2,3,4,5,6,7])
20 create an array of type float?
21. Write code for the given input to print the out put given below
Original arrays:
[[ 11 22 33 44 55]
[ 66 77 88 99 100]]
New array:
[[ 22 44 11 55 33]
[ 77 99 66 100 88]]
22.How to convert a 1D array into a 2D array