Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

numpy stack arrays vertically

import numpy as np
# ensure same shape of arrays to be stacked.
a = np.arange(10).reshape(2,-1)
b = np.repeat(1, 10).reshape(2,-1)
# use vstack() to stack by row.
out = np.vstack((a,b))
## print output
print(out)
# a
# b
Comment

PREVIOUS NEXT
Code Example
Python :: how to display percentage in pandas crosstab 
Python :: E: Unable to locate package python-gobject 
Python :: batchnormalization keras 
Python :: biggest of 3 numbers in python 
Python :: Action based permissions in Django Rest V3+ 
Python :: how to check libraries in python 
Python :: numpy array length 
Python :: convert a dictionary to pandas dataframe 
Python :: dataframe column in list 
Python :: zscore python 
Python :: how to round an array in python 
Python :: python list divide 
Python :: convert list to nd array 
Python :: python remove repeated elements from list 
Python :: secondary y axis matplotlib 
Python :: django ModelChoiceField value not id 
Python :: reverse the words in a string python 
Python :: reload flask on change 
Python :: logging - multiple log file 
Python :: ordereddict 
Python :: read emails from gmail python 
Python :: python lambda function map 
Python :: create a blank image cv2 
Python :: for i 
Python :: Pandas categorical dtypes 
Python :: remove last element from list python 
Python :: best python ide for ubuntu 
Python :: what does .shape do in python 
Python :: python set remove multiple elements 
Python :: keep only one duplicate in pandas 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =