“HSTACK” Kod odpowiedzi

HSTACK

hstack() function is used to stack the sequence of input arrays
horizontally (i.e. column wise) to make a single array.
Syntax : numpy.hstack(tup) Parameters : tup : [sequence of ndarrays] Tuple
containing arrays to be stacked.
The arrays must have the same shape along all but the second axis.
SAAD JAMAL-EDDINE

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]]
ryaba_ryaba_

NP.HSTACK w 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]])
Nervous Narwhal

Odpowiedzi podobne do “HSTACK”

Pytania podobne do “HSTACK”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu