concatenate arrays vertically python

Why do some fonts alternate the vertical placement of numerical glyphs in relation to baseline? Using a simple + operation on the list would return the concatenation of the two lists (which is not what we want!). If provided, the destination array will have this dtype. In order to concatenate more than one array, you simply concatenate the array with the concatenation of all the previous arrays. Not the answer you're looking for? On what basis do some translations render hypostasis in Hebrews 1:3 as "substance?". I want to concatenate 5 of them horizontally, that Stack Overflow. Assemble an nd-array from nested lists of blocks. Return : [stacked ndarray] The stacked array of In this section, we will learn about Python NumPy concatenate 3d arrays. When we dont specify the axis to concatenate along, the arrays are concatenated along axis 0. Use reshape () method to reshape our a1 array to a 3 by 4 dimensional array. Concatenating numpy arrays vertically and horizontally. The arrays must have the same shape along all but the first axis. You can use list comprehensions. Given two NumPy arrays, we need to add the 2nd array at the end of first array. Follow edited Feb 25, 2021 at 16:05. The only reason why this doesn't work is because of your xrange (0,444,95). np.row_stack is an alias for vstack. For example, lets use the zeros() function of NumPy to create two images This is equivalent to concatenation along the first axis after 1-D arrays Check out these GitHub recovery tools. Split an array into multiple sub-arrays vertically (row-wise). Save my name, email, and website in this browser for the next time I comment. Use np.vstack : In [4]: Find centralized, trusted content and collaborate around the technologies you use most. 1. The basic data structures in NumPy are N-dimensional arrays (N-D arrays). Note that if you are concatenating lists or arrays of different types, you may need to perform some type conversion to ensure that the concatenated result is of the desired type. Youll then learn several ways to create NumPy arrays and perform basic operations on them. np.random.rand() returns an array of numbers sample from a uniform distribution over the interval [0,1). * operator. For The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user. provided together with out. You can also create arrays of evenly spaced numbers using np.linspace(). Concatenating two one-dimensional NumPy arrays. If provided, the destination array will have this dtype. Rebuilds arrays divided by hsplit. We pass a sequence of arrays that we want to join to the concatenate () function, along with the axis. Defaults to same_kind. See documentation here. Did active frontiersmen really eat 20,000 calories a day? 1. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Consider the following Python list of numbers: You can get a NumPy array from an existing list by calling the np.array() function with the list as the argument. How to concatenate 2 lists of numpy arrays. In addition to the np.concatenate() function, NumPy provides two other functions that can be used to concatenate 2dimensional arrays: np.vstack() and And what is a Turbosupercharger? The axis parameter specifies the index of the new axis in the dimensions of the result. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. How to make numpy.argmax() return all occurrences of the maximum? Of course, in J, array concatenation works (consistently) on arrays of any rank or dimension. Stack arrays in sequence horizontally (column wise). It stacks a sequence of two or more arrays into a single NumPy array. The British equivalent of "X objects in a trenchcoat", What is the latent heat of melting for a everyday soda lime glass, "Sibi quisque nunc nominet eos quibus scit et vinum male credi et sermonem bene". numpy.split(ary, indices_or_sections, axis=0) [source] #. Consenting to these technologies will allow us and our partners to process personal data such as browsing behavior or unique IDs on this site and show (non-) personalized ads. The functions concatenate, stack and Stack Overflow. Concatenate 2-D arrays using the concatenate() function in Python We can concatenate 2-D array horizontally and vertically using the concatenate() function. 2. Split an array into multiple sub-arrays as views into ary. 1. Some of the most interesting studies of data come from combining different data sources. Input : [[Gfg, good], [is, for]]Output : [Gfgis, goodfor]Explanation : Column wise concatenated Strings, Gfg concatenated with is, and so on. Webresndarray The concatenated array. 2 numpy.concatenate with weird (3,) shaped array? 1. WebJoining NumPy Arrays. But it's also a good idea to understand how np.concatenate and its family of stack functions work. How to concatenate these two numpy arrays? This process is similar to concatenate arrays along the second axis, except for 1-D arrays where it concatenates along the first axis. You can change your settings at any time, including withdrawing your consent, by using the toggles on the Cookie Policy, or by clicking on the manage consent button at the bottom of the screen. We can concatenate these two arrays vertically using the vstack() function as shown: As the stacking happens vertically, the two arrays should have the same number of columns. Join a sequence of arrays along a new axis. as the final result, do you want to have just two columns. by hsplit. Follow answered Jul 9, 2021 at 20:09. np.array([[1,2,3], [4,5,6]]) Regardless of whether it is a list of lists or a list of 1d arrays, np.array tries to create a 2d array. numpy.vsplit. Let us understand with the help of an example. How can Phones such as Oppo be vulnerable to Privilege escalation exploits. But i am having Create three character arrays of different sizes. Relative pronoun -- Which word is the antecedent? To subscribe to this RSS feed, copy and paste this URL into your RSS reader. What is telling us about Paul in Acts 9:1? How can I change elements in a matrix to a combination of other elements? left_index: If True, use the index (row labels) from the left DataFrame or Series as its join key(s). b = array([5,6,7,8]) You could also Transpose A do a vertical stack and then transpose it back np.vstack((A.T,b)).T. Concatenate two NumPy arrays vertically mkrieger1. For example they could be the red, green, and blue color channels of an RGB image. python; numpy; Share. Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data. How to vertically concatenate two arrays in Python? I want to merge them vertically to end up having a new dataframe. 39. Share your suggestions to enhance the article. Is it superfluous to place a snubber in parallel with a diode by default? 0. 4. Concatenating vectors and matrices as columns. In this case, to concatenate two numpy arrays we need to pass two arrays to the append() method. Python - Concatenate a variable into string format, How to concatenate variables like this in python. of shape (N,) have been reshaped to (1,N). It then makes each 'row/element' into a 2d array, and concatenates them. If you wanna do this just because you cannot concatenate an array with an initialized empty array in a loop, then just use a conditional statement, e.g. tup : [sequence of ndarrays] Tuple containing arrays to be stacked. The start and the step values are optional. WebHow to concatenate Array in Python using for loop. Matching arrays or lists can be 'column_stack` - the arrays are turned into (n,1) arrays, and then joined on the 2nd dimension: An array of lists/arrays of differing size has object dtype, and is, for many purposes like a list of lists: Your last structure could written as a ragged list of lists: Notice though this doesn't line up the [8,9] with the others. 1 Answer. The Journey of an Electromagnetic Wave Exiting a Router. jupyter-notebook. acknowledge that you have read and understood our. Rebuilds arrays divided by vsplit. It's hard to help when we don't know exactly what you need or how you intend to use the resulting structure. We can use thezeros() function to create an array of zeros. Numpy is a vast library in python which is used for almost every kind of scientific or mathematical operation. WebAlgorithms. You can also stack two pandas Series vertically by passing axis=0 How to turn a boolean array into index array in numpy. Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches. is there a limit of speed cops can go on a high speed pursuit? WebYou can use the numpy.concatenate() function to concat, merge, or join a sequence of two or multiple arrays into a single NumPy array. WebAny other way of zipping would result in a list/tuple output anyway. Syntax : numpy.concatenate((arr1, arr2, ), axis=0, out=None) Parameters : arr1, arr2, : [sequence of array_like] The arrays must have the same shape, except in the dimension corresponding to axis. np.concatenate((a,)) Concatenate two arrays Python. The syntax of the vstack () function is as follows: numpy.vstack(tup) Here, tup is a sequence of arrays that we want to stack vertically. By using our site, you Do not use + to concatenate Numpy arrays. 12. Explain why vercat and cat are manual and a for loop is not manual. The axis along which the arrays will be joined may be passed as an argument. In the result, we see that 2 has been added to each element of the array. How to reshape Pandas 1 Answer. Backing up your GitHub repositories assures that you can easily access and retrieve your data if you lose data on your GitHub account. Learn, how to concatenate two NumPy arrays vertically in Python? rev2023.7.27.43548. Finding the Index of the Maximum and Minimum Elements, Learn Coding in a Fun Way on These 7 Platforms, 25 Open Datasets for Your Data Science/ML Projects, Build Stunning JavaScript Apps Using Sencha 140+ UI Components, 20 Best Productivity Apps for Programmers/Developers, 7 Self-Hosted Powerful Search Engine Software for Your Product, 6 Runtime Application Self-Protection (RASP) Tools for Modern Applications, 6 Best GitHub Backup Tool for Data Protection, 14 Python Libraries and Modules Every Developer Should Know, 17 Coding Challenges to Sharpen Your Critical Thinking, Apache Kafka: A Step-by-Step Guide for Setting Up and Running, The elements of a Python list are not necessarily stored in contiguous locations in memory. Vertical Concatenation Using vstack. The technical storage or access that is used exclusively for statistical purposes. 1. Be careful with those "Numpy is faster" claims. Using NumPy, we can perform concatenation of multiple 2D arrays in various ways and methods. The first parameter specifies the number of arguments to concatenate in each block row. I tried saving the values in an empty array like this: but this keeps resulting in a dataframe with each column from each file side by side. Set the optional axis argument to the axis youd like to concatenate along; the default value of the axis is zero. For this purpose, we will use the numpy.concatenate () method. Great! WebThe arrays that you pass to this function must have the same shape. 2. concatenating two multidimensional arrays in numpy. Array concatenation in Python. Connect and share knowledge within a single location that is structured and easy to search. I added some code to generate the numbers in your last display block. Share. You need some sort of filler/spacer. and r/g/b channels (third axis). It could be returned as np.append([0], values[0:-2:1, 19]). Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, The future of collective knowledge sharing. Join a sequence of arrays along an existing axis. 1. Here is an example. This is equivalent to concatenation along the second axis, except for 1-D Please refer to the split documentation. How to append or concatenate 'n' numpy arrays? Now pass the array1, array2 as a sequence of arrays to the concatenate method, Now pass the array1, array2 as a sequence of arrays to the hstack method, Now pass the array1, array2 as a sequence of arrays to the vstack method. Concatenating NumPy arrays. Pad each sublist with empty strings to make them the same length using another list comprehension. The hvcat () is an inbuilt function in julia which is used to concatenate the given arrays horizontally and vertically in one call. The vstack is equivalent to vertical concatenation. Closed 6 years ago. How to concatenate 2 lists of numpy arrays. 0. image-manipulation. a1_2d = a1. WebMerge, join, concatenate and compare# Can either be column names, index level names, or arrays with length equal to the length of the DataFrame or Series. Concatenate arrays of coordinates in Python. Web21. How to stack (per iteration) dataframes in column side by side in one csv file in python pandas? c = conc 0. By clicking Post Your Answer, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct. In this article, we will discuss various methods of concatenating two 2D arrays. For 0. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Load CSV into 2D matrix with NumPy for plotting, Find out if matrix is positive definite with numpy. Pass in the shape of the required array as a tuple: np.zeros(shape). 594), Stack Overflow at WeAreDevelopers World Congress in Berlin, Temporary policy: Generative AI (e.g., ChatGPT) is banned, Preview of Search and Question-Asking Powered by GenAI. Numpy module in python, provides a function numpy.hstack() function is used to stack the sequence of input arrays horizontally i.e, concatenating into a single array. The arrays must have the same shape along all but the second axis. The hstack method will take a sequence of arrays as parameters. I loop this function with different data files but will end up with every loops giving out a different sized array (which is the desired output) but I cannot figure out how to properly append these arrays. #. : my_list would now be a list of arrays of shape (x,2), where x could be different for different arrays in the list. Related questions. vsplit is equivalent to split with axis=0 (default), the array is always split along the first axis regardless of the array dimension. You can know more about the lists here: Python Data Structures. To concatenate an array inside other array? rev2023.7.27.43548. The arrays must have the same shape. master_list = [] for array in formatted_list: master_list.append(array) master_array = np.vstack(master_list) Alternatively, if you know the length of your formatted_list containing the arrays and array length you can just preallocate the master_array. Weba = np.array([1,2,3]) b = np.array([4,5,6]) np.array((a,b)) works just as well as. 0. Not consenting or withdrawing consent, may adversely affect certain features and functions. c How can I vertically concatenate 1x2 arrays in numpy? List of tab delimited arrays to numpy array? Each dataframe I have is created from a file in a directory and I want to concatenate all of them. Learn more about the NumPy argmax() function. We will vertically concatenate two/more numpy arrays using the vstack() method. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Thanks for contributing an answer to Stack Overflow! The following ways to concatenate the images is explained through below the code as: In Python, we can create an array using the NumPy module. Asking for help, clarification, or responding to other answers. Other primary verbs concatenate along other axes. Enhance the article with your expertise. arr1 is an array of ones with two rows and three columns and arr2 is an array of zeros two rows and three columns. Naive Method. We can use the concatenate() function of NumPy to concatenate the matrices of the images along different axes. In SQL we join tables based on a key, whereas in NumPy we join arrays by axes. Which one we do is specified by the axis parameter. If not, then you can simply replace a[1:] by a. Now to Concatenate two arrays vertically (row-wise), we will pass the given two arrays to the vstack() method and it will return the concatenated (stacked) array. Not the answer you're looking for? you made it, We have discussed all possible methods to concatenate a NumPy array to another NumPy array. I have an array of arrays: a = [ [[1,2], [3,4]], [[5,6], [7,8]] ] How can I, for each subarray in the above array, perform the following: reshape(-1,1) concatenate along axis=1; a is not a numpy array but it can of course be converted to a numpy array. All arrays a1, a2, .. must have the same shape along all but the first axis. Numpy array concatenation. The Overflow Blog Improving time to first byte: Q&A with Dana Lawson of Netlify Concatenating numpy arrays vertically and horizontally. I would like it to look like this: 0.0012 0.0016 0.00155 0.0019 sf_collection = (img1,img2,img3) concat_page = skimage.io.concatenate_images (sf_collection) My expected output is the three images to be concatenated vertically in one image (very long and narrow). How to Calculate the exponential value of a number in Python. By clicking Post Your Answer, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct. asked Feb 25, 2021 at 15:59. This is equivalent to concatenation along the first axis after 1-D arrays of shape (N,) have been reshaped to (1,N). Help us improve. Share. Any reasons why this might happen? The usual alias is np. The '+' operator can be used to concatenate two lists. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you. Weba1 = np.array ( [1,2,3]) a2 = np.vstack (a1) # array ( [ [1], [2], [3]]) b1 = np.array ( [4,5,6,7]) b2 = np.vstack (b2) # array ( [ [4], [5], [6], [7]]) Simply I have these two arrays with one having 3 ar1 = np.array( [1, 2, 3, 4]) If you change this to xrange (0,444,148) everything should be fine. Numpy module in python, provides a function numpy.vstack() function is used to Stack arrays in sequence vertically (row-wise). What mathematical topics are important for succeeding in an undergrad PDE course? How to concatenate array value with another array list value in Python. This can be done with putting Na in space or with a data frame if that would work and I could correct those spaces before export. send a video file once and multiple users stream it? Next, lets go over some of the basic operations on NumPy arrays. Learn how your comment data is processed. Similarly, nested lists may look similar in structure to an N-dimensional NumPy array. Concatenate two numpy arrays in the 4th dimension. It now has two rows and two columns. To start working with NumPy, you should first install the library and import it into your working environment. The vstack is equivalent to vertical concatenation. Hi @HooriM.I was just going to reply to first question but this is exactly what i'm hoping to achieve. WebSo the first loop would produce this vertical 3,2 array while the second iteration of the loop would produce the 4,2 array where I would want to append or concatenate the 4,2 array to the original 3,2 array and so on. List Comprehension. They have broadcasting capabilities and allow us to vectorize operations for speed and use built-in mathematical functions for performance improvement. itertools.chain () method. I was previously working with Matlab and there I used this: m = zeros (10, 4) % define my matrix, 10x4 v = ones (10, 1) % my vecto, 10x1 c = [m,v] % so simple! It will concatenate the arrays into one single array and returns the concatenated array. The array formed by stacking the given arrays. Are modern compilers passing parameters in registers instead of on the stack? Stacking Arrays Vertically in Python 3. How to display Latin Modern Math font correctly in Mathematica? Looking to get started with NumPy? You will be notified via email once the article is available for improvement. To install NumPy, open up your terminal and run the following command: After installing NumPy, you can import it into your working environment under an alias. Lets try adding 2 to py_list and see what happens: We see that we get a TypeError stating that we can only concatenate two lists, and adding py_list + 2 like this is not supported. Solution: , Example : array1=:3=:56array1,array2123456. The concatenate () function is usually written as np.concatenate (), but we can also write it as numpy.concatenate (). We may earn affiliate commissions from buying links on this site. The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes. Numpy array concatenation. Several functions Python - Numpy 3D array - concatenate issues. If you already have arrays, and make full use of array methods, numpy is indeed faster. Stack arrays in sequence depth wise (along third axis). df1.shape (242583, 172) df2.shape (242583, 2) My code is: Fin = pd.concat ( [df1, df2], axis= 1) But somehow the result is stacked in 2 dimensions: Fin.shape (485166, 174) Web@johnktejik, Out[474] is a list of tuples.Out[472] isn't, but for many purposes it is just as good - including the OP's purpose(s). To learn more, see our tips on writing great answers. That's why zipping isn't too popular in NumPy territory. I do not care whether it stays a Python list or is converted to a numpy array - whatever yields the most Because the stacking happens horizontally, the input arrays should have the same number of rows. In this article, I will explain To use concatenate , you need to make a and b 2D arrays instead of 1D, as in c = concatenate((atleast_2d(a), atleast_2d(b))) Webnumpy.row_stack. Concatenating/Appending Multiple Vertical Arrays of Different Sizes. Concatenate two numpy arrays together Follow combining multi numpy arrays (images) in one array (image) in python. Thank you so much! #. arr1 is an array of ones with two rows and three columns and arr2 is an array of zeros two Eliminating repeated lines from a file using Python, Read List of Dictionaries from File in Python, Python Program for Find largest prime factor of a number, Python Program for Find sum of odd factors of a number, Find the maximum length of a sublist using a list comprehension and the. # version 1: rand_arr = np.random.randint (low=5, high=10, size= (5,3)) + np.random.random ( (5,3)) # version 2: rand_arr = np.random.uniform (5,10, size= (5,3)) # 21. 1. Below is the implementation of the above approach: Time complexity: O(n^2), where n is the number of elements in the input list.Auxiliary space: O(n), for the numpy array and the padded list. A 3-dimensional array is composed of 3 nested levels of Concatenating two numpy array. The shape of the array is inferred from the size argument and the integers take on values in the interval [low,high). This is because NumPy implicitly broadcasted the scalar 2 to an array of compatible shape to yield this result. Webnumpy.vstack. They belong inside a vector with shape [4,8,8].I reshape the vector of images to become a matrix of images with shape [2,2,8,8].. How can I concatenate the images from inside the matrix to produce a single image so that the shape becomes [16,16]?I want the images to be concatenated so that One thing, there are different values in each of these columns (although, same column titles for each file) and the number of values also differs per file. i.e, concatenating into a single array. Concatenating 2d numpy arrays to a 3d numpy array. outdata2 = [0.0019, 0.0020, 0.0021]. In the resultant array, the second array arr2 is added (as rows) below the first array. What do multiple contact ratings on a relay represent? 0. Sorted by: 1. shape) How to concatenate array value with another array list value in Python. arrays where it concatenates along the first axis. It will concatenate the arrays into one single array and returns the array. The arange() function returns an array of numbers between a start and stop value in steps of a step value: start, start + step, start + 2*step up to but not including stop. WebThis function can operate both vertically and horizontally. The np.eye() function takes in only one argument: the order of the matrix (n). 0. Asking for help, clarification, or responding to other answers. WebC = vertcat (A,B) concatenates B vertically to the end of A when A and B have compatible sizes (the lengths of the dimensions match except in the first dimension). This is perfect, it worked on my test files!! You can concatenate NumPy arrays horizontally using the hstack() function, as shown below. numpy.vstack ( (a1,a2,)) Code language: Python (python) In this syntax, the (a1, a2, ) is a sequence of arrays with the ndarray type. # create three 1d arrays. Given a String Matrix, perform column-wise concatenation of strings, handling variable lists lengths. Your email address will not be published. By clicking Post Your Answer, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct. ab = np.split2d (aa, (2,3)) would result in a list of 6 matrices shaped (9,5) each. Required fields are marked *. Python NumPy concatenate 3d arrays. OverflowAI: Where Community & AI Come Together, Concatenating/Appending Multiple Vertical Arrays of Different Sizes, Behind the scenes with the folks building OverflowAI (Ep. Lets change arr2 to be of shape (2,2). We use the vstack () function from the NumPy library to do this. Learn, how to concatenate two NumPy arrays vertically in Python? 30. #. Use strvcat to vertically concatenate the text in the arrays. It's easy to generate the arrays, but printing them out in the way you show, will cost you more than what you are paying me. 396. How to perform element-wise Boolean operations on NumPy arrays? This is equivalent to concatenation along the first axis after 1-D arrays of shape (N,) have been reshaped to A funo Python NumPy numpy.concatenate () concatena mltiplas arrays sobre um eixo especificado. For example, cat(2,[1 2],[]) returns the row vector [1 2]. The concatenate method will take a sequence of arrays as parameters. Concatenation operator (+) for List Concatenation. Here are some examples: which indicates that the arrays have been concatenated vertically along the first axis. If you want to improve your skills in an existing or a new programming language, one of the best ways to do it is through coding challenges. Similarly, arr_lin2 is an array of 10 evenly spaced numbers in the interval [1,20]. In this section, well learn how to use some of these built-in functions. Were all of the "good" terminators played by Arnold Schwarzenegger completely separate machines? Concatenate two NumPy arrays vertically. Unlike, concatenate(), it joins arrays along a new axis. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, The future of collective knowledge sharing. For example, the shape of a 22 array with two rows and two columns is (2,2). 0. Each triangular array is half filled with values, with zeros on the diagonal. Why does numpy.concatenate work along axis=1 for small one dimensional arrays, but not larger ones? Web# Output: 0 1 0 Java 20000 1 Spark 25000 2 PySpark 23000 3 Pandas 28000 4 NumPy 55000 5 Python 23000 6 Oracle 28000 4. Now I am trying to do this while looping over all of the files in a directory and I want to append/concatenate these two lists (or arrays) for each file together but they could be different sizes. Concatenating two numpy array. Let's assume that result of first concatenation is as follows: And you have another file based on which you have another concatenation (the same code as the first file): In order to concat these two vertically, you should do: Then you can use it in your for loop easily: Thanks for contributing an answer to Stack Overflow! How to find the groups of consecutive elements in a NumPy array? This function makes most sense for arrays with up to 3 dimensions. Python | Nth Column vertical string in Matrix, Python Program to Check horizontal and vertical symmetry in binary matrix, Python - Concatenation of two String Tuples, Python - String concatenation in Heterogeneous list, Python - Horizontal Concatenation of Multiline Strings, Python | Consecutive prefix overlap concatenation, Python - Triple quote String concatenation, Pandas AI: The Generative AI Python Library, Python for Kids - Fun Tutorial to Learn Python Programming, A-143, 9th Floor, Sovereign Corporate Tower, Sector-136, Noida, Uttar Pradesh - 201305, We use cookies to ensure you have the best browsing experience on our website. Join a sequence of arrays along a new axis. It appears daunting, but adding a powerful search function to your application is neither complex nor time-consuming.

Westport, Wa Fireworks 2023, Baptist Church Woodbridge, Va, 3726 Sevier Heights Rd, Suite 200 Knoxville, Tn 37920, Dayton Ohio Softball Tournament, Navy Base Honolulu Hawaii, Articles C

concatenate arrays vertically python