NumPy Assignment Questions
1. a = [Link]([
[11,22,33],
[44,55,66],
[77,88,99]
])
Extract:
- first column
- last row
-[
[22 33]
[55 66]
]
2. a = [Link]([
[10,20,30],
[40,50,60],
[70,80,90]
])
Extract:
- first row
- second column
- element 50
3. Create an array from 1 to 12 and reshape it into:
- (3,4)
- (2,6)
- (2,3,2)
4. a = [Link]([1,2,3])
b = [Link]([4,5,6])
Perform:
- addition
- subtraction
- multiplication
- division
- power of 3
- square
- mean
5. Create a 1D array containing numbers from 1 to 10 using random module.
Create a 2D array of shape (3,3) containing numbers from 1 to 9 using random module.
6. Generate a random array of shape (2,5).
7. Difference between Python list and NumPy array.
8. Convert the following integer array into float datatype:
a = [Link]([1,2,3,4])
9. What is the difference between:
- dtype
- astype()
10. Create a 2D array and print:
- shape
- size
- ndim
- dtype
Change its datatype.
11. Can a 1D array be sliced like:
a[:,1]
Why or why not?