[AI] 머신러닝 Feature Scaling(StandardScaler(), MinMaxScaler()) / Dataset을 Training과 Test로 나누는 방법
원본 데이터 X, y로 분리 -> X, y의 문자열 데이터 레이블, 원핫 인코딩으로 변경한 상태이다 y # array([0, 1, 0, 0, 1, 1, 0, 1]) X >>> array([[1.0e+00, 0.0e+00, 0.0e+00, 4.4e+01, 7.2e+04], [0.0e+00, 0.0e+00, 1.0e+00, 2.7e+01, 4.8e+04], [0.0e+00, 1.0e+00, 0.0e+00, 3.0e+01, 5.4e+04], [0.0e+00, 0.0e+00, 1.0e+00, 3.8e+01, 6.1e+04], [1.0e+00, 0.0e+00, 0.0e+00, 3.5e+01, 5.8e+04], [1.0e+00, 0.0e+00, 0.0e+00, 4.8e+01, 7.9e+04], [0.0e+00, 1..
2024. 4. 12.
[Python] 판다스 2차원 데이터, 데이터프레임(DataFrame)
판다스의 2차원 데이터 처리는, 데이터 프레임으로 한다 (DataFrame) 실제 데이터 분석에서는 CSV 파일을 판다스의 '데이터 프레임'으로 읽어와서 작업한다. 변수 명 df = 데이터프레임 약자로 저장 많이 한다 데이터프레임(DataFrame)을 레이블로 생성하기 import pandas as pd # We c# reate a dictionary of Pandas Series items = {'Bob' : pd.Series(data = [245, 25, 55], index = ['bike', 'pants', 'watch']), 'Alice' : pd.Series(data = [40, 110, 500, 45], index = ['book', 'glasses', 'bike', 'pants'])} df ..
2024. 4. 11.
[Python] 판다스 시리즈 연산 _더하기, 빼기, 나누기, Boolean indexing (부등호 값 찾기)
판다스 시리즈 연산 _더하기, 빼기 연산 시리즈 데이터 index = ['apples', 'oranges', 'bananas'] data = [10, 6, 3,] fruits = pd.Series(index=index, data= data) fruits >>> apples 10 oranges 6 bananas 3 dtype: int64 - 더하기 : 전체 물품이 입고되었다 모든 물품 +5 해주자 fruits = fruits + 5 fruits >>> apples 15 oranges 11 bananas 8 dtype: int64 - 빼기 : 오렌지가 2개 팔렸다 오렌지만 -2 해주자 fruits['oranges'] = fruits['oranges'] -2 fruits >>> apples 15 oranges..
2024. 4. 9.