728x90
Starwars Character 분석
데이터 출처 : https://dplyr.tidyverse.org/reference/starwars.html
< 질문 >
- 스타워즈 캐릭터의 성별 비율
- 성별에 따른 캐릭터 신장의 분포
- 가장 무거운 캐릭터와 가장 가벼운 캐릭터
- 스타워즈 캐릭터의 키와 몸무게의 상관관계
1. 데이터 확인
# 기본 패키지 불러오기
import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
plt.style.use("seaborn")
sns.set(font_scale = 1)
import plotly.express as px
import chart_studio.plotly as py
import cufflinks as cf
cf.go_offline(connected=True)
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import plotly.offline as pyo
pyo.init_notebook_mode()
import missingno as msno
import warnings # 경고 메세지 무시하기
warnings.filterwarnings(action='ignore')
plt.rcParams['font.family'] = 'S-Core Dream' # 한글 폰트 가져오기
# 데이터 불러오기
sw = pd.read_csv("data/Starwars.csv", encoding = "utf-8-sig")
print(sw.shape)
sw.head()
<컬럼 설명>
- name: 캐릭터 이름
- height: 키
- mass: 몸무게
- hair_color: 머리카락 색
- skin_color: 피부색
- eye_color: 눈동자 색
- birth_year: 생년
- sex: 생물학적 성별
- gender: 사회적 성별
- homeworld: 고향
- species: 종
# 컬럼 기본 정보 확인하기
sw.info()
# 연속형(수치) 데이터 통계치 확인하기
sw.describe()
# 범주형(문자) 데이터 통계치 확인하기
sw.describe(include = np.object_)
# 결측치 확인 하기
sw.isnull().sum()
# 결측값 시각화로 확인 하기
msno.bar(sw)
birth_year 컬럼에 결측치가 많이 있으며 mass 컬럼에도 결측치가 상당 수 있다는 것을 확인할 수 있습니다.
#데이터 내용 간단히 정리해서 출력
print("총 데이터 개수: ", sw.shape[0]*sw.shape[1])
print("총 결측치 수: {} = 전체 데이터의 {:.2f}% ".format(sw.isnull().sum().sum(), (sw.isnull().sum().sum()*100)/(sw.shape[0]*sw.shape[1])))
print("스타워즈에 등장하는 등장인물 수: ", sw['name'].nunique())
print("스타워즈에 등장하는 종족수: ", sw['species'].nunique())
728x90
'Data Analysis > 기타 데이터' 카테고리의 다른 글
[기타 데이터] LA Lakers 경기 데이터 분석 3 (EDA / 시각화 / 리뷰) (0) | 2021.10.12 |
---|---|
[기타 데이터] LA Lakers 경기 데이터 분석 2 (데이터 전처리) (0) | 2021.10.08 |
[기타 데이터] LA Lakers 경기 데이터 분석 1 (데이터 확인 / 질문) (0) | 2021.10.08 |
[기타 데이터] Starwars 케릭터 분석 3 (EDA / 시각화 / 리뷰) (0) | 2021.10.07 |
[기타 데이터] Starwars 케릭터 분석 2 (데이터 전처리) (0) | 2021.10.07 |