Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

np.hstack

# np.hstack concatenates arrays column-wise

a = np.array([1], [2], [3]) #read as a vector, i.e. a column
b = np.array([4], [5], [6]) #read as a vector, i.e. a column 
							#concatenated to the first one
c = np.hstack((a, b)))
print(c)
# output is
# [[1, 4],
#  [2, 5],
#  [3, 6]]
Comment

hstack in numpy

>>> a = np.array((1,2,3))
>>> b = np.array((2,3,4))
>>> np.hstack((a,b))
array([1, 2, 3, 2, 3, 4])
>>> a = np.array([[1],[2],[3]])
>>> b = np.array([[2],[3],[4]])
>>> np.hstack((a,b))
array([[1, 2],
       [2, 3],
       [3, 4]])
Comment

np.hstack in python

>>> a = np.array((1,2,3))
>>> b = np.array((2,3,4))
>>> np.hstack((a,b))
array([1, 2, 3, 2, 3, 4])
>>> a = np.array([[1],[2],[3]])
>>> b = np.array([[2],[3],[4]])
>>> np.hstack((a,b),columns=['hurala','panalal'])
array([[1, 2],
       [2, 3],
       [3, 4]])
Comment

PREVIOUS NEXT
Code Example
Python :: py how to replace a string in a list 
Python :: python = align 
Python :: python to exe online 
Python :: find if value exists in dictionary python 
Python :: Django Abstract base classe 
Python :: how to speed up python code 
Python :: pandas in python 
Python :: proper pagination django template 
Python :: range() python 
Python :: how to join an array of characters in python 
Python :: pandas grid subplots 
Python :: python logging level 
Python :: django custom authentication 
Python :: // meaning in python 
Python :: pandas df.index.values 
Python :: Math Module log10() Function in python 
Python :: values missing comparing datasets 
Python :: nltk hide download messages 
Python :: python save image pytelegrambotapi 
Python :: python script for downloading files from googledrive 
Python :: webdriver python get total number of tabs 
Python :: for loop to select rows in pandas 
Python :: python mouse listener 
Python :: mnist 
Python :: tkinter fenstertitel 
Python :: how to get a list of files in a folder in python with pathlib 
Python :: find rules of decision tree python 
Python :: seaborn bar plot sort for weekday 
Python :: how to install qrcode module in python 
Python :: check for changed model fields in djnago signal 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =