일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- DP
- 새벽코딩
- 탐색
- BufferedReader
- 완전탐색
- 프로그래머스
- HashMap
- 브루트포스
- 백준
- 다이나믹프로그래밍
- 배열
- 문자열
- Java
- Stack
- SQL
- 아스키코드
- Queue
- Python
- BFS
- 그리디
- 스택
- 구현
- LIS
- 빅데이터
- 다리 만들기
- 알고리즘
- 시뮬레이션
- 백트래킹
- dfs
- oracle
Archives
- Today
- Total
새벽코딩
[빅데이터분석기사] 실기 기출문제 4회 작업형 1 본문
반응형
https://www.datamanim.com/dataset/practice/ex4.html
1-1
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/Datamanim/datarepo/main/krdatacertificate/e4_p1_1.csv')
df.head(5)
Temperature컬럼에서 숫자가 아닌 문자들을 제거후 숫자 타입으로 바꾸고 3분위수에서 1분위수의 차이를 소숫점 이하 2자리까지 구하여라
df.Temperature = df.Temperature.str.replace('*', '')
Q1 = df['Temperature'].quantile(0.25)
Q3 = df['Temperature'].quantile(0.75)
ans = round(Q3-Q1, 2)
print(ans)
1-2
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/Datamanim/datarepo/main/krdatacertificate/e4_p1_3.csv')
df.head(5)
Likes를 Comments로 나눈 비율이 20이상이면서 Keyword값이 minecraft인 영상들의 Views값의 평균을 정수로 구하여라
# Likes / Comments
df['r1'] = df['Likes'] / df['Comments']
ans = df.loc[(df.r1 >= 20) & (df.Keyword == 'minecraft'), 'Views'].mean().astype('int')
print(ans)
1-3
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/Datamanim/datarepo/main/krdatacertificate/e4_p1_3.csv')
df.head(5)
date_added가 2018년 1월 이면서 country가 United Kingdom 단독 제작인 데이터의 갯수
풀이 1 (str.split)
df2 = df.loc[(df['date_added'].str.split().str[0] == 'January') & (df['date_added'].str.split().str[2] == '2018')]
print(df2.loc[df2.country == 'United Kingdom'].shape[0])
풀이 2 (to_datetime)
df['date'] = pd.to_datetime(df['date_added'].str.strip(), format='%B %d, %Y')
df2 = df.loc[(df['date'].dt.strftime('%Y-%m') == '2018-01') & (df['country'] == 'United Kingdom')]
print(df2.shape[0])
감사합니다.
반응형
'데이터분석' 카테고리의 다른 글
[빅데이터분석기사] 실기 기출문제 5회 작업형 3 (0) | 2024.06.22 |
---|---|
[빅데이터분석기사] 실기 기출문제 작업형 2 (0) | 2024.06.21 |
[빅데이터 분석기사] 실기 (체험형) 작업형 3 풀이 (0) | 2024.06.21 |
[ADsP] 36회 데이터분석 준전문가 (합격 후기) (3) | 2023.03.28 |
Comments