-
-
Save IndhumathyChelliah/5597a14e3e0057480892d665081242e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
a1=np.array([[[0,1,2,3],[4,5,6,7]],[[8,9,10,11],[12,13,14,15]]]) | |
print (a1) | |
#Output: | |
[[[ 0 1 2 3] | |
[ 4 5 6 7]] | |
[[ 8 9 10 11] | |
[12 13 14 15]]] | |
#Accessing particular element | |
print (a1[0][1][3]) | |
#Output:7 | |
print (a1[0,1,3]) | |
#Output: 7 | |
#Accessing the first matrix | |
print (a1[0]) | |
#Output: | |
[[0 1 2 3] | |
[4 5 6 7]] | |
print (a1[0,1]) | |
#Output:[4 5 6 7] | |
print (a1[0,:,3]) | |
#Output:[3 7] | |
print (a1[1,1,0::2]) | |
#Output: [12 14] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment