1. 코드
%matplotlib inline import pandas as pd import seaborn as sns
1. 칼럼 이름 변경하기
iphone_df.rename(columns={'Unnamed: 0':'model'}, inplace=True) iphone_df
2. 인덱스 변경하기
iphone_df.set_index('model', inplace=True) iphone_df
3. 여러 조건을 만족시키는 데이터만 뽑아내기
boolean1 = iphone_df['메모리']>'3GB' boolean2 = iphone_df['Face ID']=='Yes' boolean3 = iphone_df['디스플레이']>5.5 iphone_df[boolean1 & boolean2 & boolean3]
4. split을 이용해 문자열 분리해 새로운 칼럼 생성하기
release_date = iphone_df['출시일'].str.split(pat='-', n=2, expand=True) release_date iphone_df['출시연도'] = release_date[0]
2. 발견한 인사이트
1. Face ID는 iPhone X 부터 생긴 기능임을 알 수 있음
2. 출시연도별 출시 모델 수 -> 시각화(??)
3. 한 줄 평가
- 출시일에서 출시연도만 가져와서 새로운 칼럼 '출시연도' 생성
- 출시연도별 모델 개수를 막대그래프로 나타내려고 했으나 실패함
cf. split을 이용하여 pandas 칼럼 분리하기
'DA' 카테고리의 다른 글
#06. world_cities.csv (0) | 2021.07.16 |
---|---|
#05. toeic.csv (0) | 2021.07.16 |
#04. liverpool.csv (0) | 2021.07.16 |
#03. laptops.csv (0) | 2021.07.16 |
#01. hyundee.csv / samsong.csv (0) | 2021.07.15 |