Question: import numpy as np x = np.array([1,2,3]) y = np.array([4,5,6]) It is desired to form a 2D numpy array z where the first column of

import numpy as np x = np.array([1,2,3]) y = np.array([4,5,6])

It is desired to form a 2D numpy array z where the first column of z is x and the second column of z is y. What statement will do this?

Answer:

z = np.concatenate((x.reshape((3,1)),y.reshape((3,1))),axis=1)

My question is what the axis means. I have been reading my notes over and over again and fail to understand what an axis/axes is in numpy.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!