NumPy
1.Checking dtypes:
Create a NumPy array with integers [1, 2, 3, 4] and check its data type.
2.Changing dtypes:
Convert a NumPy array [1.1, 2.2, 3.3] from float to integer.
3.Step slicing:
Create an array [0, 10, 20, 30, 40, 50, 60]. Slice every second element.
4.Column slicing:
Slice the second column from the following 2D array:
[[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
5.Basic Operations
a)Array Creation: Create a 1D NumPy array with integers from 10 to 50
(inclusive).
b)Reshaping: Create a 2D NumPy array with shape (3, 3) containing numbers from
1 to 9.
c)Array of Zeros: Create a 4x4 matrix filled with zeros.
d)Array of Ones: Create a 3x3 matrix filled with ones.
c)Random Array: Create a 1D array of 5 random numbers between 0 and 1.
6.Indexing and Slicing
a)Accessing Elements: Create a 1D array of numbers from 1 to 10. Access the 5th
element and print it.
b)Slicing: Slice the first 3 elements of a 1D array containing integers from 10
to 20.
c)Indexing 2D Arrays: Create a 3x3 matrix of numbers from 1 to 9. Access the
element in the second row, third column.
7.Mathematical Operations
a)Addition: Add 5 to every element in a 1D array of numbers from 0 to 9.
8.Generate Random Integers:
Create a 1D array of 10 random integers between 1 and 100 (inclusive).
9.Shaped Integers with randint:
Use randint to create a 2D array with shape (3, 3) containing random integers
between 1 and 100.
10. Create array with simple operatons
array([[0., 0., 0., 0., 0.],
[0., 1., 1., 1., 0.],
[0., 1., 7., 1., 0.],
[0., 1., 1., 1., 0.],
[0., 0., 0., 0., 0.]])