Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started