Which of the following function stacks 1D arrays as columns into a 2D array?

row_stack
column_stack
com_stack
all of the mentioned

The correct answer is: B. column_stack

The column_stack function stacks 1D arrays as columns into a 2D array. It takes a list of 1D arrays as input and returns a 2D array with the same number of rows as the input arrays and the number of columns equal to the sum of the lengths of the input arrays.

For example, if we have the following 1D arrays:

array1 = [1, 2, 3]
array2 = [4, 5, 6]
array3 = [7, 8, 9]

We can stack them as columns into a 2D array using the column_stack function:

“`

from numpy import column_stack
column_stack([array1, array2, array3])
array([[ 1, 4, 7],
[ 2, 5, 8],
[ 3, 6, 9]])
“`

The row_stack function stacks 1D arrays as rows into a 2D array. It takes a list of 1D arrays as input and returns a 2D array with the same number of columns as the input arrays and the number of rows equal to the sum of the lengths of the input arrays.

The com_stack function is not a valid function in NumPy.