오류해결) X와 y의 차원이 같지 않으면 피처스케일링 학습시에 오류가 생긴다.
X.shape
(500, 5)
y.shape
(500,)
y
0 35321.45877
1 45115.52566
2 42925.70921
3 67422.36313
4 55915.46248
...
495 48901.44342
496 31491.41457
497 64147.28888
498 45442.15353
499 45107.22566
Name: Car Purchase Amount, Length: 500, dtype: float64
y.values
array([35321.45877, 45115.52566, 42925.70921, 67422.36313, 55915.46248,
56611.99784, 28925.70549, 47434.98265, 48013.6141 , 38189.50601,
59045.51309, 42288.81046, 28700.0334 , 49258.87571, 49510.03356,
53017.26723, 41814.72067, 43901.71244, 44633.99241, 54827.52403,
51130.95379, 43402.31525, 47240.86004, 46635.49432, 45078.40193,
44387.58412, 37161.55393, 49091.97185, 58350.31809, 43994.35972,
17584.56963, 44650.36073, 66363.89316, 53489.46214, 39810.34817,
51612.14311, 38978.67458, 10092.22509, 35928.52404, 54823.19221,
45805.67186, 41567.47033, 28031.20985, 27815.73813, 68678.4352 ,
(...이하생략)
y.reshape(500, 1)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-72-04cc810c89b4> in <module>
----> 1 y.reshape(500, 1)
~\anaconda3\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
5463 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5464 return self[name]
-> 5465 return object.__getattribute__(self, name)
5466
5467 def __setattr__(self, name: str, value) -> None:
AttributeError: 'Series' object has no attribute 'reshape'
y.values.reshape(500,1)
array([[35321.45877],
[45115.52566],
[42925.70921],
[67422.36313],
[55915.46248],
[56611.99784],
[28925.70549],
[47434.98265],
[48013.6141 ],
[38189.50601],
[59045.51309],
[42288.81046],
[28700.0334 ],
[49258.87571],
[49510.03356],
[53017.26723],
[41814.72067],
[43901.71244],
(...이하생략)
반응형
'Python 문법 > Pandas_데이터처리' 카테고리의 다른 글
[데이터분석] 문자열과함수 .str.contains() (0) | 2021.11.30 |
---|---|
구글맵 api-Geocoding API 설정하는 방법 (0) | 2021.11.29 |
[데이터합치기] (0) | 2021.11.29 |
[데이터 정렬] sort_values() / sort(), sorted() 함수 (0) | 2021.11.23 |
[csv파일 코딩] pd.read_csv(), .to_csv() (0) | 2021.11.22 |