https://www.datamanim.com/dataset/03_dataq/typeone.html#id6
작업 1유형 — DataManim
Question 각 비디오는 10분 간격으로 구독자수, 좋아요, 싫어요수, 댓글수가 수집된것으로 알려졌다. 공범 EP1의 비디오정보 데이터중 수집간격이 5분 이하, 20분이상인 데이터 구간( 해당 시점 전,후
www.datamanim.com
Question
흡연자와 비흡연자 각각 charges의 상위 10% 그룹의 평균의 차이는?
import pandas as pd
train = pd.read_csv("https://raw.githubusercontent.com/Datamanim/datarepo/main/MedicalCost/train.csv")
train.head()

high = train.loc[train.smoker =='yes'].charges.quantile(0.9)
high2 = train.loc[train.smoker =='no'].charges.quantile(0.9)
mean_yes = train.loc[(train.smoker =='yes') &(train.charges >=high)].charges.mean()
mean_no = train.loc[(train.smoker =='no') &(train.charges >=high2)].charges.mean()
answer = mean_yes - mean_no
print(answer)

'빅데이터분석기사 > 작업 1유형' 카테고리의 다른 글
대학원 입학가능성 데이터 (0) | 2022.08.15 |
---|---|
킹카운티 주거지 가격 예측 문제 데이터 (0) | 2022.08.15 |
수질 음용성 여부 데이터 (0) | 2022.08.15 |
비행 탑승 경험 만족도 데이터 (0) | 2022.08.15 |
핸드폰 가격 예측 데이터 (0) | 2022.08.15 |