How to merge matrices using numpy
Today, I would like to share with you how to use numpy merge matrix related knowledge points, detailed content, clear logic, I believe that most people still know too much about this knowledge, so share this article for your reference, I hope you can get something after reading this article, let's take a look at it.
Column merge: np.column_stack (), where the function argument is a tuple
Line merge: np.row_stack (), where the function argument is a tuple
> import numpy as np > a = np.arange (8). Reshape (4,-1) > print (a) [[0 1] [2 3] [4 5] [6 7]] > > b = np.arange (8, 16). Reshape (4,-1) > print (b) [[8 9] [10 11] [12 13] [14 15] > > c = np.column_stack (a) ) > print (c) [[0 18 9] [2 3 10 11] [4 5 12 13] [6 7 14 15] > d = np.row_stack ((a, b)) > > print (d) [[0 1] [2 3] [4 5] [6 7] [8 9] [10 11] [12 13] [14 15]] these are all the contents of the article "how to merge Matrices with numpy" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.