TIL 119

2024-05-17

Today프로젝트 시작Today I Learned 프로젝트 선택한 주제 : 은행 고객데이터를 이용한 서비스 분석 해당 데이터의 결측값과 이상치가 많아 오늘은 전처리 위주로 진행해보기로 결정 bank.isna().sum() # 결측치 확인  이상치 확인 해당 컬럼의 1 고객 당 4개의 정보가 확실히 들어있는지 확인bank.groupby('Customer_ID')['Month'].nunique() # 얘가 다 4인지 확인해야함  >> 이상치 가 있었던 Age 와 Annual_Income 컬럼의 언더바(_) 를 제거# Annual_Income 언더바 제거result= []for i in bank['Annual_Income']: if "_" in i: i = i.replace("_","") re..

TIL 2024.05.17

2024-05-16

Today1. SQL 코드카타 1문제(94번)2. 알고리즘 코드카타 1문제 (38번)3. 전처리&시각화 라이브세션 수강4. 전처리&시각화 챌린지 풀이 Today I Learned Python 직사각형 별찍기https://lyj-01.tistory.com/147 직사각형 별찍기이 문제에는 표준 입력으로 두 개의 정수 n과 m이 주어집니다.별(*) 문자를 이용해 가로의 길이가 n, 세로의 길이가 m인 직사각형 형태를 출력해보세요.n, m = map(int, input().strip().split(' '))for i in range(lyj-01.tistory.comn, m = map(int, input().strip().split(' '))for i in range(m): print('*'*n) stri..

TIL 2024.05.16

2024-05-14

Today1. SQL 코드카타 1문제(92번)2. 판다스 300제(141~180)3. 전처리&시각화 라이브세션 수강4. 전처리&시각화 베이직 풀이 Today I LearnedPython pandas.quary() ① 비교 연산자( ==, >, >=, ② in 연산자( in, ==, not in, != )③ 논리 연산자(and, or, not)④ 외부 변수(또는 함수) 참조 연산⑤ 인덱스 검색⑥ 문자열 부분검색( str.contains, str.startswith, str.endswith )df.query("close > open")  df 문자열 검색하기df.query("nm.str.startswith('A')")df.query("nm.str.contains('홀딩스')")str.startswith()특..

TIL 2024.05.14

2024-05-13

Today1. SQL 코드카타 1문제(91번)2. 판다스 300제(91~140)3. 전처리&시각화 라이브세션  Today I Learned SQLSELECT *FROM cinemaWHERE id % 2 != 0 AND description != "boring"ORDER BY rating DESCid 를 2 로 나누었을 때 0과 같지않고description 의 값이 boring 이 아닐 때  파이썬만 주구장창 보다보니 SQL 에서의 연산자를 잊어버린 듯 기초부터 다시 천천히!   Python가장 마지막 행 추출df.iloc[-1]# (series 형태)df.tail(1) # (df 형태) iloc # 행번호loc# 행이름 df.iat[0, 2] # iloc 처럼 행, 열df.at["037730",..

TIL 2024.05.13

2024-05-10

Today1. SQL 코드카타 1문제(90번)2. 파이썬 300제(261~270)3. 판다스 300제4. 데이터 전처리 & 시각화 강의 수강 완강Today I Learned SQL https://leetcode.com/problems/confirmation-rate/SELECT s.user_id , ROUND(AVG(if(c.action = "confirmed",1,0)),2) AS confirmation_rateFROM signups AS sLEFT JOIN confirmations AS cON s.user_id = c.user_idGROUP BY user_id # 확인이 되었다면 1 그렇지 않다면 0으로 두고 평균을 내준다 구글 번역기를 돌려도 문제가 이해되지 않아 solutions 를 살펴보..

TIL 2024.05.10

2024-05-09

Today1. SQL 코드카타 1문제(89번)2. 파이썬 300제(251~260)3. 데이터 전처리 & 시각화 강의 수강(~3주차) Today I Learned데이터 전처리 & 시각화 강의https://lyj-01.tistory.com/137 [Python] Pandas 함수 정리Pandas 불러오기import pandas as pd  데이터를 파일(csv)로 저장to_csv("저장위치/파일명.파일형식") 인덱스에 대해 설정을 해주지 않으면 기본값은 inedx= True 로인덱스가 컬럼의 형태로 저장이 될 수 있lyj-01.tistory.comPandas 함수를 세세하게 다루어 볼 수 있었다. 결측치 확인df.isna() # null 값이면 Truedf['B'].isna() # B..

TIL 2024.05.09

2024-05-08

Today1. SQL 코드카타 1문제(88번)2. 파이썬 300제(219~250)3. 파이썬 총 정리 세션 수강Today I Learned SQL 테이블 3개 join 후 출력하기https://leetcode.com/problems/students-and-examinations/description/ SELECT a.student_id, a.student_name, b.subject_name, COUNT(c.subject_name)FROM students AS aLEFT JOIN examinations AS b ON a.student_id = b.student_idLEFT JOIN subjects AS c ON b.subject_name = c.subject_nameGROUP BY 1,3값이 출력되긴 했..

TIL 2024.05.08

2024-05-07

Today1. SQL 코드카타 1문제(87번)2. 파이썬 300제(151~218) Today I Learned SQL SELECT name, bonusFROM employee AS eLEFT JOIN bonus AS bON e.empid = b.empidWHERE b.bonus # bonus 가 1,000 보다 낮은 직원을 구한다면IS NULL 을 사용하여 받지 못한 직원도 고려해서 출력해야 한다. Python isupper()# 대문자면 True , 소문자면 False capitalize() # 문자열에서의 첫 글자를 대문자로 변환, 리스트는 X리스트 = ['dog', 'cat', 'parrot']for i in 리스트: a = i[0] b = a.upper() print(b+i[1:]..

TIL 2024.05.07

2024-05-03

Today1. SQL 코드카타 1문제(86번)2. 파이썬 300제(126~150)3. 파이썬 개인과제 해설 강의 Today I Learned SQL self join 을 이용한 조건 출력https://lyj-01.tistory.com/132 1661. Average Time of Process per MachineThere is a factory website that has several machines each running the same number of processes. Write a solution to find the average time each machine takes to complete a process. The time to complete a process is the lyj-..

TIL 2024.05.03

2024-05-02

Today1. SQL 코드카타(85번)2. 파이썬 300제(121~125)3. 파이썬 개인과제 제출4. 파이썬 심화함수 강의 복습 Today I Learned SQL 같은 테이블에서의 JOIN이 필요했던 문제https://lyj-01.tistory.com/129 197. Rising TemperatureWrite a solution to find all dates' Id with higher temperatures compared to its previous dates (yesterday).Return the result table in any order.The result format is in the following example.SELECT w1.idFROM weather AS w1JOIN wea..

TIL 2024.05.02