일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- sklearn
- Kaggle
- 카카오
- Python
- python3
- 튜닝
- oracle
- R
- level 2
- level 1
- 머신러닝
- 오라클
- 알고리즘
- 데이터 분석
- SQL
- 프로그래머스
- 빅분기
- matplotlib
- 실습
- 코딩테스트
- 파이썬
- Numpy
- 실기
- pandas
- seaborn
- 빅데이터 분석 기사
- Oracel
- Today
- Total
목록Python (164)
라일락 꽃이 피는 날
1. zeros 0으로 채워진 지정된 모양과 유형의 새로운 배열을 반환한다. numpy.zeros(shape, dtype) shape : 반환할 배열의 모양 dtype : 반환할 데이터 유형 np.zeros(5) # array([ 0., 0., 0., 0., 0.]) np.zeros((5,), dtype=int) # array([0, 0, 0, 0, 0]) np.zeros((2, 1)) # array([[ 0.], # [ 0.]]) 2. ones 1로 채워진 지정된 모양과 유형의 새로운 배열을 반환한다. numpy.ones(shape, dtype) shape : 반환할 배열의 모양 dtype : 반환할 데이터 유형 np.ones(5) # array([1., 1., 1., 1., 1.]) np.ones((..
1. 연산 함수 add(덧셈), subtract(뺄셈), multiply(곱셈), divide(나눗셈) x = np.array([1, 2, 3]) y = np.array([4, 5, 6]) np.add(x, y) # array([5, 7, 9]) np.subtract(x, y) # array([-3, -3, -3]) np.multiply(x, y) # array([ 4, 10, 18]) np.divide(x, y) # array([0.25, 0.4 , 0.5 ]) 2. 통계 함수 min(최솟값), max(최댓값), argmin(최솟값의 인덱스), argmax(최댓값의 인덱스), mean(평균), median(중앙값), var(분산), std(표준편차) x = np.array([1, 2, 3, 4, 5, ..
Package → Folder Module → File/Folder Package/Module를 불러오는(import) 방법 - import - from import 사용 할 Module의 경로가 여러 폴더를 거쳐야 하는 경우 .(dot) 연산자로 경로 구분을 한다. import myPack myPack.module1.func1() myPack.module1.func2() myPack.bin.module2.func3() myPack.bin.module2.func4() import myPack.module1 import myPack.bin.module2 myPack.module1.func1() myPack.module1.func2() myPack.bin.module2.func3() myPack.bin.mo..
파일 입출력 터미널에 결과물을 출력하는 것이 아닌 파일 형태로 출력 할 수 있게 하기 위해 사용한다. 터미널에서 input 함수를 사용하여 입력를 받아 동작하는 것이 아닌 파일 형태로 입력을 받아서 동작 할 수 있게 하기 위해 사용한다. open('file_path/file_name', mode) mode : 읽기(r), 덮어쓰기(w), 이어쓰기(a) path = 'C:/test.txt' fw = open(path, mode='w', encoding='utf-8') fw.write('쓰기 위한 문자열 1\n') fw.write('쓰기 위한 문자열 2\n') fw.close() path = 'C:/test.txt' # 예외 처리 try: fo = open(path, mode='r') print(fo.rea..
strftime 주어진 형식에 따라 날짜 데이터를 문자열로 반환한다. %Y 연도 (4자리) ex) 2021년 → 2021 %y 연도 (2자리) ex) 2021년 → 21 %m 월 (숫자) ex) 1월 → 01 %d 일 ex) 15일 → 15 %H 시 (24시간) ex) 오후 5시 → 17 %I 시 (12시간) ex) 오후 5시 → 5 %M 분 ex) 8분 → 08 %S 초 ex) 24초 → 24 %A 요일 ex) 월요일 → Monday %a 요일 (축약) ex) 월요일 → Mon %B 월 (문자) ex) 1월 → January %b 월 (축약) ex) 1월 → Jan import datetime dt_now = datetime.datetime.now() d_today = datetime.date.toda..
melt 기준이 되는 변수를 선택해서 지정하고, 그 변수를 기준으로 컬럼을 행으로 재구조화시키는 함수다. pandas.melt(frame, id_vars=[], value_vars=[]) id_vars : 기준이 되는 변수 value_vars : 행으로 대입할 변수들 https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.melt.html pandas.melt — pandas 1.2.4 documentation If True, original index is ignored. If False, the original index is retained. Index labels will be repeated as necessary. pandas.py..
1. 배열 합치기 (concatenate) 기준이 되는 축을 따라 배열 순서를 결합한다. a = np.array([[1, 2], [3, 4]]) b = np.array([[5, 6]]) np.concatenate((a, b), axis=0) # array([[1, 2], # [3, 4], # [5, 6]]) np.concatenate((a, b.T), axis=1) # array([[1, 2, 5], # [3, 4, 6]]) np.concatenate((a, b), axis=None) # array([1, 2, 3, 4, 5, 6]) 2. 배열 나누기 (split) 배열을 여러 개의 하위 배열로 분할한다. numpy.split(ary, N) 축을 따라 N등분하여 분할한다. x = np.arange(9.0..
Comprehension (함축) 1. List Comprehension a = [x for x in range(101)] print(a) # [0, 1, 2, ..., 99, 100] b = [x for x in range(101) if x % 2 == 0] print(b) # [0, 2, 4, ..., 98, 100] from random import randint c = [randint(0, 100) for x in range(101)] print(c) # [55, 17, 6, ..., 23, 91] 랜덤 값 d = [True if x % 2 == 0 else False for x in range(101)] print(d) # [True, False, True, ..., False, True] e ..