Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created January 20, 2021 07:57
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/c1865d08030ad9746f774417a2b9032b to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/c1865d08030ad9746f774417a2b9032b to your computer and use it in GitHub Desktop.
import numpy as np
a1=np.array([[1,2],[3,4]])
a2=np.array([[10,20],[30,40]])
#Horizontal stacking
print(np.hstack((a1,a2)))
#Output:
[[ 1 2 10 20]
[ 3 4 30 40]]
#Vertical Stacking
print (np.vstack((a1,a2)))
#Output:
[[ 1 2]
[ 3 4]
[10 20]
[30 40]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment