numpy.ma.row_stack() in Python Last Updated : 16 Jul, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report numpy.ma.row_stack() : This function helps stacking arrays row wise in sequence vertically manner. Parameters : tup : sequence of ndarrays. 1D arrays must have same length, arrays must have the same shape along with all the axis. Result : Row-wise stacked arrays Code #1: Explaining row_stack() Python3 1== # importing libraries import numpy as np # row_stacking array a = np.array([1, 2, 3]) arr = np.ma.row_stack (a) print ("arr : \n", arr) # row_stacking array b = np.array([[1], [2], [3]]) arr1 = np.ma.row_stack (b) print ("\narr1 : \n", arr1) Output : arr : [[1] [2] [3]] arr1 : [[1] [2] [3]] Code #2: Error generated with row_stack() Python3 1== # importing libraries import numpy as np # row_stacking array b = np.array([[1, 1], [2], [3]]) arr1 = np.ma.row_stack (b) print ("\narr1 : \n", arr1) Output : ValueError: all the input array dimensions except for the concatenation axis must match exactly. Comment More infoAdvertise with us Next Article numpy.matrix() in Python M mohit gupta_omg :) Follow Improve Article Tags : Python Python-numpy Practice Tags : python Similar Reads numpy.stack() in Python NumPy is a famous Python library used for working with arrays. One of the important functions of this library is stack(). Important points:stack() is used for joining multiple NumPy arrays. Unlike, concatenate(), it joins arrays along a new axis. It returns a NumPy array.to join 2 arrays, they must 6 min read numpy.vstack() in python numpy.vstack() is a function in NumPy used to stack arrays vertically (row-wise). It takes a sequence of arrays as input and returns a single array by stacking them along the vertical axis (axis 0).Example: Vertical Stacking of 1D Arrays Using numpy.vstack()Pythonimport numpy as geek a = geek.array( 2 min read numpy.column_stack() in Python numpy.column_stack() function is used to stack 1-D arrays as columns into a 2-D array.It takes a sequence of 1-D arrays and stack them as columns to make a single 2-D array. 2-D arrays are stacked as-is, just like with hstack function. Syntax : numpy.column_stack(tup) Parameters : tup : [sequence of 2 min read numpy.ma.mask_rows() function | Python In this numpy.ma.mask_rows() function, mask rows of a 2D array that contain masked values. This function is a shortcut to mask_rowcols with axis equal to 0. Syntax : numpy.ma.mask_rows(arr, axis = None) Parameters : arr : [array_like, MaskedArray] The array to mask. The result is a MaskedArray. axis 2 min read numpy.matrix() in Python This class returns a matrix from a string of data or array-like object. Matrix obtained is a specialised 2D array. Syntax : numpy.matrix(data, dtype = None) : Parameters : data : data needs to be array-like or string dtype : Data type of returned array. Returns : data interpreted as a matrix Python 1 min read numpy.ma.mask_rowcols() function | Python In this numpy.ma.mask_rowcols() function, mask rows and/or columns of a 2D array that contain masked values. The masking behavior is selected using the axis parameter. If axis is None, rows and columns are masked. If axis is 0, only rows are masked. If axis is 1 or -1, only columns are masked. Synta 2 min read Like