numpy basics
numpy basics
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)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