이번 포스팅은 빅데이터 분석기사 실기 작업형 1유형 - 2회, 3회, 4회, 5회 기출 변형을 토대로
작업형 1유형을 대비해보겠습니다.
아래의 링크에 있는 데이터마님 페이지에서 문제를 가져와보았습니다.
이전 포스팅처럼 나와있는 해석이 아닌 더 쉬운 풀이로 풀어보겠습니다
https://www.datamanim.com/dataset/practice/ex2.html
2회 기출 변형 — DataManim
3-1-c 위의 통계량에 대한 p-값을 구하고 (반올림하여 소숫점 이하 3째자리), 유의수준 0.05하에서 귀무가설과 대립가설중 유의한 가설을 하나를 선택하시오(귀무/대립)
www.datamanim.com
#2-1
A = df['CRIM'].sort_values(ascending=False).head(10)
print(A.index)
print(A)
print(A.iloc[-1])
df.loc[A.index, 'CRIM'] = A.iloc[-1]
result = df.loc[df.AGE >= 80, 'CRIM'].mean()
print(result)
#2-2
p = int(df.shape[0] * 0.8)
A = df.iloc[:p, :]
bf= A['total_bedrooms']
af = bf.fillna(bf.median())
result = bf.std() - af.std()
print(round(result, 4))
#2-3
A = df['latitude']
mean, std = A.mean(), A.std()
lower = mean - (std * 1.5)
upper = mean + (std * 1.5)
result = A[A<lower].sum() + A[A>upper].sum()
print(result)
https://www.datamanim.com/dataset/practice/ex3.html
3회 기출 변형 — DataManim
Attention 다이어트약의 전후 체중 변화 기록이다. DataUrl = https://raw.githubusercontent.com/Datamanim/datarepo/main/krdatacertificate/e3_p3_1.csv 투약 후 체중에서 투약 전 체중을 뺏을 때 값은 일반 적으로 세가지 등
www.datamanim.com
#3-1
from sklearn.model_selection import train_test_split
df = df.dropna()
A, _ = train_test_split(df, train_size=0.7, shuffle=False)
result = A['housing_median_age'].quantile(0.25)
print(int(result))
#3-2
A = df[df['year'] == 2000].T
dfA = A.iloc[1:,0]
mean = dfA.mean()
print(dfA[dfA>mean].shape[0])
#3-3
A = df.isna().sum()
result = A.sort_values(ascending=False).index[0]
result = A.index[A.argmax()]
https://www.datamanim.com/dataset/practice/ex4.html
4회 기출 변형 — DataManim
Attention 어느 학교에서 수학 시험을 본 학생 100명 중 60명이 60점 이상을 받았다. 이 학교의 수학 시험의 평균 점수가 60점 이상인지 95%의 신뢰 수준에서 검정하려한다.
www.datamanim.com
#4-1
A = df['age']
Q1, Q2 = A.quantitle([0.25, 0.75])
abs = abs(Q1 - Q2)
int(abs)
#4-2
rate = (df['loves'] + df['wows'])/ df['reactions']
cond = (A > 0.4) | (A < 0.5) & (df['type'] = 'video')
result = A[cond].shape[0]
result = cond.sum()
#4-3
cond1 = df['date_added'].str.contains('2018')
cond2 = df['date_added'].str.contains('January')
cond3 = df['country'] == 'United Kingdom'
df[cond1 & cond2 & cond3].shape[0]
(cond1 & cond2 & cond3).sum()
#or
A = df['date_added'].astype('datatime64')
cond1 = (A >= '2018-01-01')
cond2 = (A <= '2018-01-31')
cond3 = df['country'] == 'United Kingdom'
df[cond1 & cond2 & cond3].shape[0]
(cond1 & cond2 & cond3).sum()
https://www.datamanim.com/dataset/practice/ex5.html
5회 기출 변형 — DataManim
1-1 20L가격과 5L가격이 모두 0원이 아닌 데이터만 필터를 한 후, 각 row별로 20L가격과 5L가격의 차이를 ‘차이가격’ 이라 부른다고 하자. 시도명 별 차이가격의 평균가격을 비교할때 그 값이 가장
www.datamanim.com
#5-1
cond = (df['20L가격'] != 0) & (df['5L가격'] != 0)
A = df[cond].copy()
A['가격차이'] = A['20L가격'] - A['5L가격']
result = round(A.groupby('시도명')['가격차이'].mean().max())
print(result)
#5-2
df['height(M)'] = df['height(cm)']/100
df['BMI'] = df['weight(kg)']/(df['height(M)'] ** 2)
A = (df['BMI'] >= 25).sum()
B = (df['BMI'] < 18.5).sum()
result = A + B
print(result)
#5-3
A = df.loc[:, df.columns.str.contains('전입')].sum(axis=1)
B = df.loc[:, df.columns.str.contains('전출')].sum(axis=1)
df['순유입인원'] = A - B
result = df.groupby('년도')['순유입인원'].max().sum()
print(result)
간단한 코드로 좋은 성적 받으시길 바라겠습니다.
감사합니다.
'IT.데이터' 카테고리의 다른 글
빅데이터 분석기사 실기 - 작업형 2유형 준비 / 2회 기출 변형 해설 (0) | 2023.06.22 |
---|---|
빅데이터 분석기사 실기 - 작업형 2유형 준비 / 평가 함수, 사용 라이브러리 import (0) | 2023.06.20 |
빅데이터 분석기사 실기 - 작업형 3유형 준비 / 카이제곱, 피셔의 정확 검정 (Fisher's Exact Test), 비모수 검정 (0) | 2023.06.20 |
빅데이터 분석기사 실기 - 작업형 3유형 준비 / t-test, ANOVA (0) | 2023.06.19 |
빅데이터 분석기사 실기 - 작업형 3유형 준비 / 예상문제 풀이 (0) | 2023.06.19 |
댓글