반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- discrete_scatter
- vscode
- C언어
- web 개발
- 웹 용어
- html
- inorder
- postorder
- 결합전문기관
- web
- 재귀함수
- broscoding
- web 용어
- CES 2O21 참여
- bccard
- 머신러닝
- pycharm
- classification
- 대이터
- mglearn
- cudnn
- paragraph
- 데이터전문기관
- Keras
- CES 2O21 참가
- KNeighborsClassifier
- 자료구조
- tensorflow
- java역사
- web 사진
Archives
- Today
- Total
bro's coding
AICE.DATA.PREPROCESSING 본문
반응형
필요 라이브러리 임포트
import numpy as np
import pandas as pd
#파일 읽어오기
df = pd.read_csv(’data_v1.csv’)
#탐색적 데이터 분석
#상위 디폴트 5개 : df.head()
#하위 디폴트 5개 : df.tail()
#자료구조 파악 : df.info()
#데이터 인덱스 : df.index
#데이터 컬럼명 : df.columns
#데이터 Values : df.values
#Null 데이터 확인 : df.isnull().sum()
#통계 정보 : df.describe()
#데이터 전처리
#자료 구조 파악 info 사용(Row, column, Not-null, type)
#customerID는 필요 없으니 삭제
df.drop(’customerID’, axis =1 , inplace=True)
#범주형 문자 데이터 ⇒ 숫자 변환 필요
cond = (df[’TotalCharges’] == ‘ ‘) (df[’TotalCharges’] == ‘’)
df[cond]로 결과 확인 위에 조건이 해당되는 것들이 있다는 거
df[’TotalCharges’].replace([’ ‘], [’0’], inplace=True)
df[’TotalCharges’] = df[’TotalCharges’].astype(float)
df[’Churn’].value_counts()
df[’Churn’].replace([’Yes’, ’No’], [1, 0], inplace=True)
#결측치 처리
#컬럼별 Null 값 얼마나 있는지 확인 : df.isnull.sum()
#결측치 처리
df.drop(’DeviceProtection’, axis=1, inplace=True)
df.dropna(inplace=True)
반응형
'[CERTIFICATION] > AICE' 카테고리의 다른 글
AICE.REF (0) | 2023.07.26 |
---|---|
AICE.DNN (0) | 2023.07.26 |
AICE.NORMALIZITION (0) | 2023.07.26 |
AICE.ML (0) | 2023.07.26 |
AICE.DATA.PREPROCESSING (0) | 2023.07.26 |
AICE.DATA.VISUALIZITION (0) | 2023.07.26 |
Comments