Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created January 22, 2021 05:32
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/42e820eab093519802fcf5e1ca889a9d to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/42e820eab093519802fcf5e1ca889a9d to your computer and use it in GitHub Desktop.
import numpy as np
# Dimensions and shape of the arrays are different
a1=np.ones([3,2])
print (a1)
'''
#Output:
[[1. 1.]
[1. 1.]
[1. 1.]]
'''
a2=np.arange(1,13).reshape(2,3,2)
print (a2)
'''
#Output:
[[[ 1 2]
[ 3 4]
[ 5 6]]
[[ 7 8]
[ 9 10]
[11 12]]]
'''
print (a1+a2)
'''
#Output:
[[[ 2. 3.]
[ 4. 5.]
[ 6. 7.]]
[[ 8. 9.]
[10. 11.]
[12. 13.]]]
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment