How can you slicing a NumPy array? The concept is same as python list implementation. Let us see how to implement slicing.
First of all, let's create a NumPy array
import numpy as np
list_of_number = [6, 7, 8, 9, 10]
arr = np.array(list_of_number)
To create a slice of [6, 7, 8] from the array, you can run this code
print(arr[0:3])
you will get this output
[6 7 8]
That is how you can slice an array to create a set of new sliced array. Thank you for reading this blog and have a good day!
Top comments (0)