Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created January 19, 2021 06:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/77292af6640396d8a1ecb196e791c9cf to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/77292af6640396d8a1ecb196e791c9cf to your computer and use it in GitHub Desktop.
import numpy as np
a1=np.array([10,20,30,40,50,60])
#Single index
print (a1[3])
#Output: 40
#Slice
print (a1[2:5])
#Output: [30,40,50]
#List of index
print (a1[[1,4]])
#Output: [20 50]
#Slice with step
print (a1[1::2])
#Output: [20 40 60]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment