No real need to add values after performing train_test_split as the output is an array itself. Simply try with:

Xtrain = Xtrain.reshape(-1,1)
Xtest = Xtest.reshape(-1,1)
Answer from Celius Stingher on Stack Overflow
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.ndarray.reshape.html
numpy.ndarray.reshape — NumPy v2.4 Manual
Unlike the free function numpy.reshape, this method on ndarray allows the elements of the shape parameter to be passed in as separate arguments.
Discussions

AttributeError: 'numpy.ndarray' object has no attribute 'numpy'
@ptrblck, Hi! I’m trying to visualize the adversarial images generated by this script: https://pytorch.org/tutorials/beginner/fgsm_tutorial.html This tutorial is used for the mnist data. Now I want to use for other data which is trained using the inception_v1 architecture, below is the gist ... More on discuss.pytorch.org
🌐 discuss.pytorch.org
12
0
April 9, 2019
Python Coding help- keep recieving error message"AttributeError: 'numpy.ndarray' object has no attribute 'MESSAGE_A'"
You should not be accessing dataframe columns with the dot notation. This is one of the reasons why. Use uplift_df['MESSAGE_A']. More on reddit.com
🌐 r/learnpython
9
18
October 16, 2022
AttributeError: 'list' object has no attribute 'reshape'
i have a error in this line of my code python: AttributeError: 'list' object has no attribute 'reshape' More on github.com
🌐 github.com
3
January 23, 2019
python 2.7 - Tensorflow error using tf.image.random : 'numpy.ndarray' object has no attribute 'get_shape' - Stack Overflow
Intro I am using a modified version of the Tensorflow tutorial "Deep MNIST for experts" with the Python API for a medical images classification project using convolutionnal networks. I want to More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com › tensorflow › tensorflow › issues › 1399
Error using tf.image.random._ : 'numpy.ndarray' object has no attribute 'get_shape' · Issue #1399 · tensorflow/tensorflow
March 6, 2016 - AttributeError: 'numpy.ndarray' object has no attribute 'get_shape' My Tensor "images" is an ndarray (shape=[batch, im_size, im_size, channels]) of "batch" ndarrays (shape=[im_size, im_size, channels]). Just to check if my input data was packed in the right shape and type, I have tried to apply this simple function in the (not modified) tutorial "Tensorflow Mechanics 101" and I get the same error.
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.ndarray.reshape.html
numpy.ndarray.reshape — NumPy v2.2 Manual
Unlike the free function numpy.reshape, this method on ndarray allows the elements of the shape parameter to be passed in as separate arguments.
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.ndarray.shape.html
numpy.ndarray.shape — NumPy v2.2 Manual
>>> import numpy as np >>> x = np.array([1, 2, 3, 4]) >>> x.shape (4,) >>> y = np.zeros((2, 3, 4)) >>> y.shape (2, 3, 4) >>> y.shape = (3, 8) >>> y array([[ 0., 0., 0., 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0., 0., 0., 0.]]) >>> y.shape = (3, 6) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: total size of new array must be unchanged >>> np.zeros((4,2))[::2].shape = (-1,) Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: Incompatible shape for in-place modification. Use `.reshape()` to make a copy with the desired shape.
🌐
Quora
quora.com › Why-do-I-get-numpy-ndarray-object-has-no-attribute-append-error
Why do I get “numpy.ndarray object has no attribute append error”? - Quora
In NumPy, we call its shape (2, 3, 5). The shape of an array is fixed. ... [3] ndarrays cannot change in size and shape. (You can, however, change values inside an ndarray, provided the replacements are of the same type.)
Find elsewhere
🌐
GitHub
github.com › dmlc › minpy › issues › 44
AttributeError: type object 'NDArray' has no attribute 'reshape' · Issue #44 · dmlc/minpy
I see. The problem is our setup.py. It will download an old mxnet version by default (0.5a3). This version is too old and the reshape is not implemented in NDArray class.
🌐
GitHub
github.com › apache › incubator-mxnet › issues › 13970
AttributeError: 'list' object has no attribute 'reshape' · Issue #13970 · apache/mxnet
January 23, 2019 - i have a error in this line of my code python: AttributeError: 'list' object has no attribute 'reshape' the code is def feedforward(x, W1, W2, b1, b2): z1=np.dot(W1, x.reshape(4,1))+b1 a1=relu(z1) z2=np.dot(W2, a1)+b2 a2=sigmoid(z2) retu...
Author   toufikoss
🌐
HKR Trainings
hkrtrainings.com › home › community › machine learning › attributeerror: 'numpy.ndarray' object has no attribute 'values'
AttributeError: 'numpy.ndarray' object has no attribute 'values' - Machine Learning - HKR Community
Training_Set = Training_Set.valuessc = MinMaxScaler(feature_range=(0, 1))Train = sc.fit_transform(Training_Set) AttributeError Traceback (most recent call last)<ipython-input-38-46db85ef43d1> in <module>----> 1 Training_Set = Training_Set.values 2 sc = MinMaxScaler(feature_range=(0, 1)) 3 Train = sc.fit_transform(Training_Set) AttributeError: 'numpy.ndarray' object has no attribute 'values'
🌐
Edureka Community
edureka.co › home › community › categories › python › attributeerror numpy ndarray object has no...
AttributeError numpy ndarray object has no attribute append | Edureka Community
August 10, 2020 - x_train=[] y_train=[] for i in range(8,64): x_train.append(trs[i-8:i,0]) ... ) AttributeError: 'numpy.ndarray' object has no attribute 'append'
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.ndarray.shape.html
numpy.ndarray.shape — NumPy v2.5.dev0 Manual
As with numpy.reshape, one of the new shape dimensions can be -1, in which case its value is inferred from the size of the array and the remaining dimensions. Reshaping an array in-place will fail if a copy is required. ... Setting arr.shape is deprecated and may be removed in the future. Using ndarray.reshape is the preferred approach.
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.ndarray.shape.html
numpy.ndarray.shape — NumPy v2.4 Manual
>>> import numpy as np >>> x = np.array([1, 2, 3, 4]) >>> x.shape (4,) >>> y = np.zeros((2, 3, 4)) >>> y.shape (2, 3, 4) >>> y.shape = (3, 8) >>> y array([[ 0., 0., 0., 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0., 0., 0., 0.]]) >>> y.shape = (3, 6) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: cannot reshape array of size 24 into shape (3,6) >>> np.zeros((4,2))[::2].shape = (-1,) Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: Incompatible shape for in-place modification.
🌐
NumPy
numpy.org › doc › 2.0 › reference › generated › numpy.ndarray.shape.html
numpy.ndarray.shape — NumPy v2.0 Manual
>>> x = np.array([1, 2, 3, 4]) >>> x.shape (4,) >>> y = np.zeros((2, 3, 4)) >>> y.shape (2, 3, 4) >>> y.shape = (3, 8) >>> y array([[ 0., 0., 0., 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0., 0., 0., 0.]]) >>> y.shape = (3, 6) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: total size of new array must be unchanged >>> np.zeros((4,2))[::2].shape = (-1,) Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: Incompatible shape for in-place modification. Use `.reshape()` to make a copy with the desired shape.