728x90

언어 별로 표준 함수 들은 유사한 기능들이 존재하지만 문법이 조금씩 달라서 정리해 보는 것이 좋을 것 같아 적어 보았다.

가장 많이 사용하는 함수 20개... 심화 학습까지 준비해 봅시다.

분류 라이브러리명 함수명 사용 문법 설명 예제 예제실행결과
데이터 분석 pandas read_csv pd.read_csv('file.csv') CSV 파일 읽기 pd.read_csv('data.csv') DataFrame 출력
데이터 분석 pandas DataFrame pd.DataFrame(data) 데이터프레임 생성 pd.DataFrame({'A':}) ADataFrame
수학 연산 numpy array np.array() 배열 생성 np.array() array()
수학 연산 math sqrt math.sqrt(x) 제곱근 계산 math.sqrt(9) 3.0
문자열 처리 built-in split str.split(sep) 문자열 분할 "a,b".split(",") ['a','b']
문자열 처리 re search re.search(pattern, string) 패턴 검색 re.search(r'\d','a1') <re.Match>
파일 처리 built-in open open(file, mode) 파일 열기 open('test.txt').read() 파일 내용
파일 처리 os listdir os.listdir(path) 디렉토리 목록 os.listdir('.') 파일리스트
날짜/시간 datetime now datetime.now() 현재 시간 datetime.now() 현재시간출력
날짜/시간 pandas to_datetime pd.to_datetime(str) 날짜 변환 pd.to_datetime('2023-01-01') Timestamp
데이터 시각화 matplotlib plot plt.plot(x,y)  그래프 plt.plot(,[3, 그래프 출력
데이터 시각화 seaborn barplot sns.barplot(x,y,data) 막대 그래프 sns.barplot(x='A',y='B',data=df) 그래프
머신러닝 sklearn train_test_split train_test_split(X,y) 데이터 분할 X_train, X_test = ... 분할데이터
머신러닝 tensorflow Sequential tf.keras.Sequential() 모델 생성 model = Sequential() 모델객체
 개발 flask Flask Flask(name)  생성 app = Flask(name) 앱객체
 개발 requests get requests.get(url) HTTP 요청 http://ex.com 응답객체
데이터베이스 sqlite3 connect sqlite3.connect(db) DB 연결 conn = sqlite3.connect('test.db') 연결객체
데이터베이스 pymongo find collection.find(query) 문서 조회 db.col.find({}) 커서객체
병렬 처리 threading Thread threading.Thread(target) 스레드 생성 t = Thread(target=func) 스레드객체
병렬 처리 multiprocessing Process Process(target) 프로세스 생성 p = Process(target=func) 프로세스
728x90

+ Recent posts