0% found this document useful (0 votes)
2 views2 pages

Numpy Assignment 5

The document contains a series of NumPy assignment questions covering various operations such as array extraction, reshaping, arithmetic operations, and data type conversions. It also includes tasks related to random array generation and comparisons between Python lists and NumPy arrays. Additionally, it addresses the differences between certain NumPy attributes and methods, as well as slicing techniques for arrays.
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)
2 views2 pages

Numpy Assignment 5

The document contains a series of NumPy assignment questions covering various operations such as array extraction, reshaping, arithmetic operations, and data type conversions. It also includes tasks related to random array generation and comparisons between Python lists and NumPy arrays. Additionally, it addresses the differences between certain NumPy attributes and methods, as well as slicing techniques for arrays.
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

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?

You might also like