일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 기초프로젝트
- lambda
- 클러스터링
- jd
- data analyst
- Python
- 프롬프트 엔지니어링
- 태블로
- 전처리
- 기초통계
- SQLD
- 크롤링
- 서브쿼리
- 팀프로젝트
- 시각화
- 최종 프로젝트
- 히트맵
- 머신러닝
- da
- GA4
- 데이터 분석
- If
- SQL
- Chat GPT
- 프로젝트
- pandas
- 데이터분석
- 군집화
- cross join
- streamlit
Archives
- Today
- Total
세조목
TIL(Today I Learned)62일차(24.02.09) 본문
SQL, PYTHON 예제
1. SQL
https://leetcode.com/problems/immediate-food-delivery-ii/description/
WITH FIRST AS (
SELECT DELIVERY_ID, CUSTOMER_ID, ORDER_DATE, CUSTOMER_PREF_DELIVERY_DATE,
RANK() OVER(PARTITION BY CUSTOMER_ID ORDER BY ORDER_DATE) RANKING
FROM DELIVERY
),
SECOND AS (
SELECT DELIVERY_ID, CUSTOMER_ID, ORDER_DATE, CUSTOMER_PREF_DELIVERY_DATE
FROM FIRST
WHERE RANKING = 1
),
THIRD AS (
SELECT DELIVERY_ID,
CUSTOMER_ID,
ORDER_DATE,
CUSTOMER_PREF_DELIVERY_DATE,
IF(ORDER_DATE = CUSTOMER_PREF_DELIVERY_DATE, 'IMMEDIATE', 'SCHEDULED') D
FROM SECOND
)
SELECT ROUND((COUNT(*) / (SELECT COUNT(*) FROM THIRD)) * 100, 2) IMMEDIATE_PERCENTAGE
FROM THIRD
WHERE D = 'IMMEDIATE'
2. PYTHON
https://school.programmers.co.kr/learn/courses/30/lessons/12947
def solution(x):
answer = 0
val = str(x)
for i in range(len(val)):
answer+=int(val[i])
val2 = answer
if x % val2 == 0:
return True
else:
return False
https://school.programmers.co.kr/learn/courses/30/lessons/12912
def solution(a, b):
answer = 0
if a < b:
for i in range(a, b+1):
answer+=i
elif a==b:
answer+=a
else:
for i in range(b, a+1):
answer+=i
return answer
SQLD(13주차)
심화 프로젝트
DAU 구하기
# data type을 날짜로 변환
train_df2['date'] = train_df2['date'].apply(lambda x: pd.to_datetime(str(x), format = '%Y%m%d'))
# DAU 라인 차트로 표시
a = train_df2.groupby(['date'], as_index=False).agg({'fullVisitorId' : pd.Series.nunique})
sns.lineplot(data = a, x = 'date', y = 'fullVisitorId')
'데이터 분석 공부 > TIL(Today I Learned)' 카테고리의 다른 글
TIL(Today I Learned)64일차(24.02.11) (0) | 2024.02.11 |
---|---|
TIL(Today I Learned)63일차(24.02.10) (0) | 2024.02.10 |
TIL(Today I Learned)61일차(24.02.08) (0) | 2024.02.08 |
TIL(Today I Learned)60일차(24.02.07) (1) | 2024.02.07 |
TIL(Today I Learned)59일차(24.02.06) (0) | 2024.02.06 |