Python Tutorial - Numpy Hstack

Veröffentlicht am: 28 Juli 2018
auf dem Kanal: Python Marathon
3,178
46

Descargar el Código: patreon.com/pythonmaraton

Join Patreon: patreon.com/pythonmaraton
^Downloadable code & more! np.hstack() is a numpy function using two or more arrays that allows you to combine arrays and make them into one array. Hstack stands for horizontal stack. This video explains how to use python numpy hstack function on arrays / matrices.

This is a Python anaconda tutorial for help with coding, programming, or computer science. These are short python videos dedicated to troubleshooting python problems and learning Python syntax. For more videos see Python Help playlist by Rylan Fowers.

✅Subscribe:    / @pythonmaraton  

📺Channel:    / @pythonmaraton  

▶️Watch Latest Python Content:    • Python String Slice and List Slice  

▶️Watch Latest Other Content:    • Video  





How to use np.hstack in python

we import numpy as np

And now we will create some arrays to demonstrate with.

To create an array type np.array, parentheses, bracket to start the matrix, and a bracket starting each row. End by closing the last bracket and parentheses.

We will press the up arrow on the keyboard to bring that up again, and we can edit it to make a matrix y

So here we have matrix x

and here is matrix y

we type np.hstack with parenthesis, and then you MUST make the entry a tuple, so do double parenthesis and put x comma y close close

Notice the x array is on the left and the y matrix is on the right since we put x first then y. h stack is horizontal stack. For it to work, both matrices must have the same amount of ROWS

So remember HR Hstack works when Rows line up.

There you have it, that is how you use Hstack in python

#PythonMarathon #LearnPython #PythonTutorial


Auf dieser Seite können Sie das Online-Video Python Tutorial - Numpy Hstack mit der Dauer online in guter Qualität ansehen, das der Benutzer Python Marathon 28 Juli 2018 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 3,178 Mal angesehen und es wurde von 46 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!