SiLaure's Data

[Python EDA] Stackoverflow 2020 survey 본문

Records of/Another

[Python EDA] Stackoverflow 2020 survey

data_soin 2021. 7. 28. 18:08

 

EDA를 수행할 때 포함되어야 하는 것들은 다음과 같다.
1. 평균, 분산과 같은 통계량들을 확인하였는가?
2. 시각화 기법들(barplot, histplot 등)을 사용하였는가?
3. pivot table을 이용하여 데이터를 다양한 시각으로 관찰하였는가?
4. pandas fancy indexing을 활용하여 원하는 데이터를 필터링하여 사용하였는가?
5. 분석한 코드에 설명(주석 or Markdown)을 기재하였는가?

 

 

일단 import와 data 읽어오기

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme(style='whitegrid')

plt.style.use('ggplot')

public = pd.read_csv("../material/survey_results_public.csv")
schema = pd.read_csv("../material/survey_results_schema.csv")

 

해야할 건 "교육수준"과 "직업상태"에 대한 데이터들을 추출하기

row가 너무 길어서 다 보고 싶었는데, 그러면 리스트로 바꿔서 print  하면 된다고 한다.

sch_list = pd.DataFrame(schema, columns=["Column","QuestionText"])

 

sch_list = schema.values.tolist()

 

 

sch_list = schema.values.tolist() 
sch_list = np.array(sch_list) 
print(sch_list)

리스트로 변환 완료

 

내가 질문과 연관 있다고 생각하는 것들만 뽑아봤다.

public_a = public[["Student", "Employment", "FormalEducation", "CompanySize", "JobSatisfaction","CareerSatisfaction", "SalaryType", "EducationTypes", "EducationParents", "RaceEthnicity"]]
public_a.info()
public_a.Employment.value_counts()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 98855 entries, 0 to 98854
Data columns (total 10 columns):
 #   Column              Non-Null Count  Dtype 
---  ------              --------------  ----- 
 0   Student             94901 non-null  object
 1   Employment          95321 non-null  object
 2   FormalEducation     94703 non-null  object
 3   CompanySize         71531 non-null  object
 4   JobSatisfaction     69276 non-null  object
 5   CareerSatisfaction  76504 non-null  object
 6   SalaryType          51070 non-null  object
 7   EducationTypes      67960 non-null  object
 8   EducationParents    61813 non-null  object
 9   RaceEthnicity       57473 non-null  object
dtypes: object(10)
memory usage: 7.5+ MB
Employed full-time                                      70495
Independent contractor, freelancer, or self-employed     9282
Not employed, but looking for work                       5805
Employed part-time                                       5380
Not employed, and not looking for work                   4132
Retired                                                   227
Name: Employment, dtype: int64

 

 

이제 이걸 정제해야 할 것 같은데... 어디서부터 해야할 지 감이 안 잡힌다.

best practice 보고 나서 계속 이어나가 봐야지

Comments