[캐글] Courses - Data Cleaning(2)
2. Scaling and Normalization
3. Parsing Dates
2. Scaling and Normalization
Scaling vs. Normalization: What's the difference?
- scaling : 데이터 범위를 변경
- normalization : 데이터 분포의 모양을 변경
Scaling
- 0-1과 같은 특정 척도에 맞도록 데이터를 변환
- 한 단위 변경에 동일한 중요성이 부여
Normalization
- 정규 분포로 설명할 수 있도록 변경
- Box-Cox 변환 : 정규화하는 데 사용하는 방법
3. Parsing Dates
- 날짜 형식으로 보인다고 해서 파이썬이 날짜로 인식하지 않음
Convert our date columns to datetime
- parsing dates(날짜 구문 분석) : 변환 문자열을 가져와서 파이썬이 날짜로 인식하도록 구성 요소를 식별
- 가장 일반적인 형태 : %d(일), %m(월), %y(2자리 연도), %Y(4자리 연도)
- 다른 형태는 strftime directive 참고
- pd.to_datetime()
ex) landslides['date'], format="%m/%d/%y"
Select the day of the month
- .dt.day()
ex) landslides['date_parsed'].dt.day
Plot the day of the month to check the date parsing
- sns.distplot()
ex) sns.distplot(day_of_month_landslides, kde=False, bins=31)
kde
: 그래프에 선 표시
bins
: 막대 수 조절