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))
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
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
BUG: Series has no attribute "reshape" after adding a new category in df
We are trying to add the new fillna ... functionality. Running the above snippet will get us the attribute error AttributeError: 'Series' object has no attribute 'reshape'... More on google.com
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
How to fix: Pandas Profiling (v 2.8) Error: 'Series' object has no attribute 'reshape'
Hi community! I've been running into a problem and have looked relentlessly on the internet for a solution. However, I couldn't find one. The problem… More on google.com
Videos
- YouTube
Pandas : AttributeError: 'Series' object has no attribute 'reshape'
AttributeError: 'Series' object has no attribute 'reshape'
Pandas : "DataFrame" object has no attribute 'reshape'
01:40
How to Fix the AttributeError: 'Series' Object Has No Attribute ...
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 ·
YouTube
youtube.com › vlogize
Resolving the "AttributeError: Series Object Has No Attribute Reshape" in Pandas - YouTube
Disclaimer/Disclosure: Some of the content was synthetically produced using various Generative AI (artificial intelligence) tools; so, there may be inaccurac...
Published August 6, 2024 Views 15
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
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
y = y.reshape(1, examples) should instead be y = np.reshape(1, examples) numpy.org/doc/stable/reference/generated/numpy.reshape.html ... This is sklearn.datasets.fetch_openml? If so, target return can be target: np.array, pandas Series or DataFrame. So, the question would be why you get a different target on different machines. Right after fetch_openml, you could assert isinstance(y, np.ndarray) and get rid of the rest of the script as not relevant.
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
Google
google.com › goto
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]))
HatchJS
hatchjs.com › home › series object has no attribute ‘reshape’: how to fix this error
Series object has no attribute 'reshape': how to fix this error
January 5, 2024 - This error can be fixed by using the `reshape()` method on the Series' index instead of the Series itself. For example, to reshape a Series with 100 rows into a 10x10 array, you would use the following code: `series.index.reshape(10, 10)`.