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 :: python get file name without dir 
Python :: change to first letter capital list python 
Python :: get range of items of python list 
Python :: python f string 
Python :: how to ask a question in python 
Python :: convert datetime to date python 
Python :: read file into list python 
Python :: drupal 8 request_time 
Python :: Converting uint8 into integers 
Python :: pandas pivot 
Python :: batchnorm1d pytorch 
Python :: Plotly set axes labels 
Python :: how to rotate screen with python 
Python :: calculate the distance between two points 
Python :: datetime date from string 
Python :: how to fix Crypto.Cipher could not be resolved in python 
Python :: Sum values of column based on the unique values of another column 
Python :: pip install python-telegram-bot 
Python :: install python 3.6 dockerfile 
Python :: python currency format locale 
Python :: otp generation in python 
Python :: logging - multiple log file 
Python :: python shortest distance between two points 
Python :: seaborn correlation heatmap 
Python :: python float to decimal 
Python :: publisher python ros 
Python :: pandas where 
Python :: django login view 
Python :: print p py pyt pyth pytho python in python 
Python :: python slicing nested list 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =