For a 2D array like this:
table = np.array([[11,12,13],[21,22,23],[31,32,33],[41,42,43]])
Is it possible to use np.reshape
on table
to get an array single_column
where each column of table
is stacked vertically? This can be accomplished by splitting table
and combining with vstack
.
single_column = np.vstack(np.hsplit(table , table .shape[1]))
Reshape can combine all the rows into a single row, I'm wondering if it can combine the columns as well to make the code cleaner and possibly faster.
single_row = table.reshape(-1)