Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created Jan 20, 2021
Embed
What would you like to do?
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