Solution was linked on reshaped method on documentation page.
Insted of Y.reshape(-1,1) you need to use:
Y.values.reshape(-1,1)
Answer from Hrvoje on Stack Overflow Top answer 1 of 4
161
Solution was linked on reshaped method on documentation page.
Insted of Y.reshape(-1,1) you need to use:
Y.values.reshape(-1,1)
2 of 4
32
The solution is indeed to do:
Y.values.reshape(-1,1)
This extracts a numpy array with the values of your pandas Series object and then reshapes it to a 2D array.
The reason you need to do this is that pandas Series objects are by design one dimensional. Another solution if you would like to stay within the pandas library would be to convert the Series to a DataFrame which would then be 2D:
Y = pd.Series([1,2,3,1,2,3,4,32,2,3,42,3])
scaler = StandardScaler()
Ys = scaler.fit_transform(pd.DataFrame(Y))
Reddit
reddit.com › r/learnpython › how to fix: pandas profiling (v 2.8) error: 'series' object has no attribute 'reshape'
r/learnpython on Reddit: How to fix: Pandas Profiling (v 2.8) Error: 'Series' object has no attribute 'reshape'
September 3, 2020 - -> 2744 values = values.reshape(tuple((1,) + shape)) # type: ignore 2745 return values 2746 ~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\generic.py in __getattr__(self, name) 5128 if self._info_axis._can_hold_identifiers_and_holds_name(name): 5129 return self[name] -> 5130 return object.__getattribute__(self, name) 5131 5132 def __setattr__(self, name: str, value) -> None: AttributeError: 'Series' object has no attribute 'reshape' Pandas is 1.1 ·
Profile generation failure - AttributeError: 'Series' object has no attribute 'reshape'
1 Line of code data quality profiling & exploratory data analysis for Pandas and Spark DataFrames. - Data-Centric-AI-Community/ydata-profiling More on github.com
python - MNIST AttributeError: 'Series' object has no attribute 'reshape' - Stack Overflow
This is obviously working with the MNIST dataset. This code runs fine in Python v3.6.8 on my old computer but fails in v3.9.12. What is the answer to get this to work? The error message: ----------... More on stackoverflow.com
AttributeError: 'Series' object has no attribute 'reshape'
AttributeError: 'Series' object has no attribute 'reshape' While following your code, the error is thrown in the line: y = data['sales'].values.reshape(-1,1) More on github.com
How to fix the Attribute error:'Series' object has no attribute 'reshape' in this python code? - Stack Overflow
I'm trying to make a recommendation system using the knn algorithm. I imported pandas(latest version 0.24) and created a sparse matrix. And now I am using reshape function but it is showing the err... More on stackoverflow.com
Videos
GitHub
github.com › pandas-dev › pandas › issues › 35731
BUG: Series has no attribute "reshape" after adding a new category in df · Issue #35731 · pandas-dev/pandas
August 14, 2020 - -> 2747 values = values.reshape(tuple((1,) + shape)) # type: ignore 2748 return values 2749 ~/.pyenv/versions/3.7.0/envs/fair_ml/lib/python3.7/site-packages/pandas/core/generic.py in __getattr__(self, name) 5128 if self._info_axis._can_hold_identifiers_and_holds_name(name): 5129 return self[name] -> 5130 return object.__getattribute__(self, name) 5131 5132 def __setattr__(self, name: str, value) -> None: AttributeError: 'Series' object has no attribute 'reshape'
Author chen-bowen
GitHub
github.com › pandas-profiling › pandas-profiling › issues › 545
Profile generation failure - AttributeError: 'Series' object has ...
August 13, 2020 - Profile generation failure - AttributeError: 'Series' object has no attribute 'reshape'#545 · Copy link · justinsola · opened · on Aug 13, 2020 · Issue body actions · Describe the bug · I apologize if I am reporting poorly or misunderstanding the basics, I am inexperienced and this is my first bug report.
Author justinsola
Stack Overflow
stackoverflow.com › questions › 74524908 › mnist-attributeerror-series-object-has-no-attribute-reshape
python - MNIST AttributeError: 'Series' object has no attribute 'reshape' - Stack Overflow
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Input In [3], in <cell line: 14>() 10 examples = y.shape[0] 11 #print(y.shape) 12 #print(y) ---> 14 y = y.reshape(1, examples) 15 Y_new = np.eye(digits)[y.astype('int32')] 16 Y_new = Y_new.T.reshape(digits, examples) File ~\Anaconda3\lib\site-packages\pandas\core\generic.py:5575, in NDFrame.__getattr__(self, name) 5568 if ( 5569 name not in self._internal_names_set 5570 and name not in self._metadata 5571 and name not in self._accessors 5572 and self._info_axis._can_hold_identifiers_and_holds_name(name) 5573 ): 5574 return self[name] -> 5575 return object.__getattribute__(self, name) AttributeError: 'Series' object has no attribute 'reshape'
GuidingCode
guidingcode.com › home › how to fix “attributeerror: ‘series’ object has no attribute ‘reshape'” in python?
[Fixed] AttributeError: 'Series' Object Has No Attribute 'Reshape'
January 26, 2023 - # import pandas library import pandas as pd # make an array array = [2, 4, 6, 8, 10, 12] # create a series series_obj = pd.Series(array) # convert the series object simple array arr = series_obj.values # convert the series object into a numpay array arr2 = series_obj.to_numpy() # reshaping series reshaped_arr = arr.reshape((3, 2)) reshaped_arr2 = arr2.reshape((2, 3)) # display the arrays print(reshaped_arr,"\n\n") print(reshaped_arr2) ... To conclude this article on how to fix the “AttributeError: ‘series’ object has no attribute ‘reshape’” error in Python, we have discussed what a series is in Python and why we get this particular error.
Coder Legion
coderlegion.com › 367 › resolved-attributeerror-dataframe-object-has-no-attribute-reshape
Resolved: Attributeerror: 'dataframe' object has no attribute 'reshape' - Coder Legion
Encountering the `AttributeError 'DataFrame' object has no attribute 'reshape'` is common when using Pandas in Python. It happens due to the absence of the reshape attribute within the DataFrame class, especially during reshaping operations. However,...
GitHub
github.com › marcopeix › ISL-linear-regression › issues › 3
AttributeError: 'Series' object has no attribute 'reshape' · Issue #3 · marcopeix/ISL-linear-regression
June 8, 2020 - AttributeError: 'Series' object has no attribute 'reshape' While following your code, the error is thrown in the line: y = data['sales'].values.reshape(-1,1)
Author NanduRaj
Stack Overflow
stackoverflow.com › questions › 56607596 › how-to-fix-the-attribute-errorseries-object-has-no-attribute-reshape-in-thi
How to fix the Attribute error:'Series' object has no attribute 'reshape' in this python code? - Stack Overflow
8 AttributeError: 'Series' object has no attribute 'rolling' 1 reshape is deprecated issue when I pick series from pandas Dataframe
HatchJS
hatchjs.com › home › how to fix attributeerror: ‘series’ object has no attribute ‘reshape’
How to Fix AttributeError: 'Series' object has no attribute 'reshape'
January 5, 2024 - To avoid the error `AttributeError: ‘series’ object has no attribute ‘reshape’`, you can use the `reindex` method to change the shape of a Series. The `reindex` method allows you to change the index of a Series, which in turn changes ...
PyTorch Forums
discuss.pytorch.org › t › attributeerror-series-object-has-no-attribute-as-matrix › 69328
AttributeError: 'Series' object has no attribute 'as_matrix' - PyTorch Forums
February 11, 2020 - When I execute the code of the official website, I get such an error. Why? code show as follow: landmarks_frame = pd.read_csv(‘F:\OfficialData\faces\face_landmarks.csv’) n = 65 img_name = landmarks_frame.iloc[n, 0] landmarks = landmarks_frame.iloc[n, 1:].as_matrix() landmarks = landmarks.astype(‘float’).reshape(-1, 2) print(‘Image name: {}’.format(img_name)) print(‘Landmarks shape: {}’.format(landmarks.shape)) print(‘First 4 Landmarks: {}’.format(landmarks[:4]))