데이터 엔지니어

Programming Language/Python

[Python] Numpy 행별 열별 max, min, sum, mean 구하는 방법

#1 행별, 열별 합 #2 행별, 열별 최대값 #3 행별, 열별 최소값 #4 행별, 열별 평균 #1 행별, 열별 합 import numpy as np temp_list = [[1,3,5,7,9], [2,4,6,8,10]] temp_np_array = np.array(temp_list) print(temp_np_array, temp_np_array.shape) print(temp_np_array.sum(axis=1)) print(temp_np_array.sum(axis=0)) #2 행별, 열별 최대값 import numpy as np temp_list = [[1,3,5,7,9], [2,4,6,8,10]] temp_np_array = np.array(temp_list) print(temp_np_array, ..

Programming Language/Python

[Python] Numpy 모든 요소의 max, min, sum, mean 구하는 방법

import numpy as np temp_list = [[1,3,5,7,9], [2,4,6,8,10]] temp_np_array = np.array(temp_list) print(temp_np_array, temp_np_array.shape) print(temp_np_array.sum()) print(temp_np_array.max()) print(temp_np_array.min()) print(temp_np_array.mean())

Programming Language/Python

[Python] 1차원,2차원,3차원 리스트를 numpy array로 변경하는 방법

#1 1차원 리스트를 넘파이 어레이로 #2 2차원 리스트를 넘파이 어레이로 #3 3차원 리스트를 넘파이 어레이로 #1 1차원 리스트를 넘파이 어레이로 import numpy as np temp_list = [1,3,5,7,9] temp_np_array = np.array(temp_list) print(temp_list, type(temp_list), len(temp_list)) print(temp_np_array, type(temp_np_array), len(temp_np_array), temp_np_array.shape) #2 2차원 리스트를 넘파이 어레이로 import numpy as np temp_list = [[1,3,5,7,9], [2,4,6,8,10]] temp_np_array = n..

Programming Language/Python

[Python] numpy로 랜덤 데이터 고정하는 방법

#1 랜덤 사용 #2 랜덤 여러번 출력 #3 랜덤 반복문에서 출력 #4 랜덤 고정 #1 랜덤 사용 import numpy as np random_list = np.random.randint(5, size=3) print(random_list) #2 랜덤 여러번 출력 import numpy as np random_list = np.random.randint(5, size=3) print(random_list) print(random_list) print(random_list) #3 랜덤 반복문에서 출력 import numpy as np for _ in range(5): random_list = np.random.randint(5, size=3) print(random_list) #4 랜덤 고정 import..

Programming Language/Python

[Python] string to datetime (yyyy-mm-dd *)

#1 yyyy-mm-dd 문자열을 datetime 타입으로 변경 #2 yy-mm-dd 문자열을 datetime 타입으로 변경 #3 yyyy-mm-ddTHH:MM:ss 문자열을 datetime 타입으로 변경 #4 yyyy-mm-dd HH:MM:ss 문자열을 datetime 타입으로 변경 #1 yyyy-mm-dd 문자열을 datetime 타입으로 변경 from datetime import datetime str_1 = "2023-01-07" print(str_1, type(str_1)) dt_1 = datetime.strptime(str_1, "%Y-%m-%d") print(dt_1, type(dt_1)) #2 yy-mm-dd 문자열을 datetime 타입으로 변경 from datetime import da..

Programming Language/Python

[Python] timeit 사용하는 방법

#1 for문 속도 측정하기 #1 for문 속도 측정하기 import timeit def test_for(): for i in range(100): i += 1 t1 = timeit.repeat(stmt='test_for()', setup='from __main__ import test_for', number=10000, repeat=3) print(t1)

Programming Language/Python

[Python] isinstance()로 데이터 타입 확인하는 방법

#1 str 타입 확인하기 #2 int 타입 확인하기 #3 float 타입 확인하기 #4 list 타입 확인하기 #5 dict 타입 확인하기 #6 set 타입 확인하기 #7 tuple 타입 확인하기 #1 str 타입 확인하기 temp_str = "park" temp_int = 15 temp_float = 1.53 temp_list = [1, 2] temp_dict = {"a": 1, "b": 2} temp_set = {1,2,3} temp_tuple = (1,2,3) print(isinstance(temp_str, str)) print(isinstance(temp_int, str)) print(isinstance(temp_float, str)) print(isinstance(temp_list, str))..

Programming Language/Python

[Python] ",", " " 포함하는 문자열을 리스트로 만들기 (string to list)

#1 문자열 출력 -> temp_str = "kim,park,choi" #2 문자열을 리스트로 만들기 #3 예외상황 (띄어쓰기) -> temp_str = "kim , park , choi" #4 예외상황 처리 (띄어쓰기) #5 예외상황 (반점만 찍힌 것들 무시하기) -> temp_str = "kim , park , choi,,,,,,," #6 예외상황 처리 (반점만 찍힌 것들 무시하기) #1 문자열 출력: temp_str = "kim,park,choi" temp_str = "kim,park,choi" print(temp_str) #2 문자열을 리스트로 만들기 temp_str = "kim,park,choi" temp_list = [value for value in temp_str.split(",")] pr..

Programming Language/Python

[Python] enumerate() 사용해보기

#1 일반 반복문 #2 enumerate() 사용 #3 enumerate() 의 index, value 사용 #4 enumerate() 의 index, value 사용 2 #1 일반 반복문 temp_list = ["kim", "park", "choi"] for _l1 in temp_list: print(_l1) #2 enumerate() 사용 temp_list = ["kim", "park", "choi"] for _l1 in enumerate(temp_list): print(_l1) #3 enumerate() 의 index, value 사용 temp_list = ["kim", "park", "choi"] for index, value in enumerate(temp_list): print(f"index:..

개인 일정/공부

[NoSQL] NoSQL이란

NoSQL이란? NoSQL은 "Not only SQL"의 약자로, 관계형 데이터베이스 관리 시스템(RDBMS)과는 다른 형태의 데이터베이스 관리 시스템을 가리키는 용어입니다. NoSQL 데이터베이스는 비관계형 데이터베이스 형식으로, 대량의 분산 데이터를 처리하고 저장하기 위해 설계되었습니다. NoSQL 데이터베이스는 다양한 형태와 모델을 가지며, 주로 대규모 데이터의 실시간 처리와 확장성에 중점을 둡니다. 이러한 데이터베이스는 스키마가 없거나 유연한 스키마를 제공하며, 관계형 데이터베이스에서 사용되는 전통적인 테이블 형식의 데이터 모델을 따르지 않을 수 있습니다. NoSQL 데이터베이스의 종류로는 다음과 같은 것들이 있습니다: 1. 키-값 스토어(Key-Value Store): 각 데이터 항목을 고유한..

박경태
'분류 전체보기' 카테고리의 글 목록 (27 Page)