python - Converting a list into numpy array of specific ...
stackoverflow.com › questions › 44507987Jun 12, 2017 · Converting a list into numpy array of specific dimension. I am working on polynomial train-test fit problem and want to convert a list object into a numpy array of the form (4, 100). (i.e., 4 rows, 100 columns) I have the following code: from sklearn.linear_model import LinearRegression from sklearn.preprocessing import PolynomialFeatures from numpy import array np.random.seed (0) n = 15 x = np.linspace (0,10,n) + np.random.randn (n)/5 y = np.sin (x)+x/6 + np.random.randn (n)/10 X_train, ...