https://www.datamanim.com/dataset/03_dataq/typeone.html#id6
작업 1유형 — DataManim
Question 각 비디오는 10분 간격으로 구독자수, 좋아요, 싫어요수, 댓글수가 수집된것으로 알려졌다. 공범 EP1의 비디오정보 데이터중 수집간격이 5분 이하, 20분이상인 데이터 구간( 해당 시점 전,후
www.datamanim.com
Question
Vehicle_Age 값이 2년 이상인 사람들만 필터링 하고 그중에서
Annual_Premium 값이 전체 데이터의 중간값 이상인 사람들을 찾고, 그들의 Vintage값의 평균을 구하여라
import pandas as pd
df = pd.read_csv("https://raw.githubusercontent.com/Datamanim/datarepo/main/insurance/train.csv")
df.head()
answer = df[(df['Vehicle_Age']=='> 2 Years') & (df['Annual_Premium'] >= df['Annual_Premium'].median())]['Vintage'].mean()
print(answer)
Question
vehicle_age에 따른 각 성별(gender)그룹의 Annual_Premium값의 평균을 구하여 아래 테이블과 동일하게 구현하라
df.groupby(['Gender','Vehicle_Age'],as_index = False)['Annual_Premium'].mean()
meandf = df.groupby(['Gender','Vehicle_Age'],as_index = False)['Annual_Premium'].mean()
meandf.pivot(index='Vehicle_Age',columns='Gender',values='Annual_Premium')
'빅데이터분석기사 > 작업 1유형' 카테고리의 다른 글
비행 탑승 경험 만족도 데이터 (0) | 2022.08.15 |
---|---|
핸드폰 가격 예측 데이터 (0) | 2022.08.15 |
성인 건강검진 데이터 (0) | 2022.08.15 |
서비스 이탈예측 데이터 (0) | 2022.08.15 |
기온 강수량 데이터 (0) | 2022.08.15 |