본문 바로가기
자격증 공부/빅데이터분석기사

빅데이터 분석기사 실기 모의고사 - 작업형 1유형(11)

by 해모해모 2023. 6. 22.
728x90
반응형

# 주어진 데이터에서 상위 10개 국가의 접종률 평균과 하위 10개 국가의 접종률 평균을 구하고, 그 차이를 구해보세요 # (단, 100%가 넘는 접종률 제거, 소수 첫째자리까지 출력)
import pandas as pd

df = pd.read_csv('/kaggle/input/covid-vaccination-vs-death/covid-vaccination-vs-death_ratio.csv')
# print(df.head())

df = df.groupby('country').max() # 접종률은 계속 올라가니까 한 국가의 최고 접종률로 기준을 잡는다
df = df.sort_values(by = 'ratio', ascending = False)
# print(df['ratio'].head())

cond = df['ratio'] > 100
df = df.drop(df[cond].index, axis = 0)
# print(df['ratio'].head())

upper = df['ratio'].iloc[:10].mean()
# print(upper)

lower = df['ratio'].iloc[-10:].mean()
# print(lower)

print(round(upper - lower, 1))

# 정답 : 88.4

출처_퇴근후딴짓(캐글) : https://www.kaggle.com/datasets/agileteam/bigdatacertificationkr

 

Big Data Certification KR

빅데이터 분석기사 실기 (Python, R tutorial code)

www.kaggle.com

출처_퇴근후딴짓(유튜브) : https://www.youtube.com/@ai-study

 

퇴근후딴짓

퇴근 후, 함께 재미있게 성장하는 딴짓 커뮤니티 비 전공, 다른 직무라도 Re-skilling이 필요한 시대입니다. 함께 AI, 머신러닝, 딥러닝을 재미있게 Study 시작해보아요 :) 새롭게 알게 된 것, 공부한

www.youtube.com

 

728x90
반응형

댓글