[Airflow] Dag 정보 (Task Context) 전달
·
Python/모듈 & 패키지 & 라이브러리
...from train_model.main import runlocal_tz = pendulum.timezone("Asia/Seoul")...dag = DAG( dag_id='train_model_dag', default_args=default_args, schedule_interval='30 9 * * *', # 매일 09:30 실행 catchup=False)process_task = PythonOperator( task_id='train_model', python_callable=run, dag=dag) 위와 같이 간단한 dag을 구성 후 train_model의 run 함수에서 airflow에서 작업을 수행한 시간인 execution_date를 가져오고 싶었다..
[Python] Window에 pyenv 설치
·
Python/Setting
프로젝트마다 사용하는 python 버전이 달라질 수 있으므로, pyenv를 사용하기로 결정 1. 설치https://github.com/pyenv-win/pyenv-win GitHub - pyenv-win/pyenv-win: pyenv for Windows. pyenv is a simple python version management tool. It lets you easily switch betpyenv for Windows. pyenv is a simple python version management tool. It lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the U..
[Pyinstaller] xgboost XGBoostLibraryNotFound error
·
Python/Error
문제 상황xgboost를 import한 .py 파일을 pyinstaller로 .exe 로 패키징 할 때 다음과 같은 에러를 출력xgboost.libpath.XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?List of candidates:C:\...\AppData\Local\Temp\_MEI103562\xgboost\xgboost.dllC:\...\AppData\Local\Temp\_MEI103562\xgboost\../../lib/xgboost.dllC:\...\AppData\Local\Temp\_MEI103562\xg..
[Python] matplotlib 한글 폰트 전역 설정
·
Python/Setting
Window 환경입니다.1. 폰트 다운 & 설치저는 네이버 무료 폰트인 나눔체를 설치했습니다.네이버 글꼴 모음 (naver.com) 네이버 글꼴 모음네이버가 만든 150여종의 글꼴을 한번에 만나보세요hangeul.naver.com설치를 진행 후 Window의 경우 .ttf 우클릭 \(\rightarrow\) 모든 사용자용으로 설치를 진행합니다.(모든 사용자용으로 설치를 진행해야 C:\Windows\Fonts에 설치 됩니다. 그냥 설치하면 C:\Windows\User\AppData\... 에 설치 됩니다.)2. matplotlibrc 수정import matplotlib.font_manager as fmimport matplotlib as mplprint(mpl.matplotlib_fname())위 코드를 ..
[Python] 리스트의 원소 곱 - reduce
·
Python/모듈 & 패키지 & 라이브러리
리스트 내의 모든 원소들을 곱해주는 함수를 간단하게 사용하고 싶어서 찾아보았습니다. 원소들을 더해주는 함수는 sum() 함수를 사용하면 빠르게 결과를 얻을 수 있지만, 곱해주는 함수는 보지 못한 것 같아 이번에 정리하고자 글을 작성합니다. reduce functiools 내장 모듈로, 여러 개의 데이터를 대상으로 주로 누적 집계를 내기 위해서 사용합니다. 기본 문법은 다음과 같습니다. from functools import reduce reduce(집계 함수, 순회 가능한 데이터) example 리스트 내의 모든 원소들을 곱해주는 함수 reduce(lambda x, y: x*y, num_list) 리스트 내의 모든 원소들을 더해주는 함수 reduce(lambda x, y: x+y, num_list)
[Python] 화면 캡쳐 라이브러리 처리 속도 비교
·
Python/모듈 & 패키지 & 라이브러리
개요 Python에서 화면을 캡쳐를 수행하는 라이브러리는 다양하게 존재합니다. 그러나 라이브러리 간 처리 속도의 차이가 있으며, 이는 프로젝트를 수행함에 있어 많은 영향을 미친다. 따라서 이 게시글에서는 라이브러리의 처리 속도를 비교하고 어떤 라이브러리가 가장 효과적인지에 대해 알아봅니다. 라이브러리 대표적으로 화면을 캡쳐할 수 있는 라이브러리는 Pillow, pyautogui, mss 가 존재합니다. (관련 라이브러리의 자세한 설명은 생략하겠습니다.) 성능 다음과 같이 화면의 일부 영역을 캡쳐하는 코드를 구현하였습니다. import cv2 import mss import time import pyautogui import numpy as np from PIL import ImageGrab x1, y1,..
[Python] / [pytube] Youtube 영상 처리
·
Python/모듈 & 패키지 & 라이브러리
Pytube https://github.com/pytube/pytube GitHub - pytube/pytube: A lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos. A lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos. - GitHub - pytube/pytube: A lightweight, dependency-free Python library (and command-line ut... github.com How to use ? from..
[Python] / [pafy] Youtube 영상 처리
·
Python/모듈 & 패키지 & 라이브러리
pafy https://github.com/mps-youtube/pafy GitHub - mps-youtube/pafy: Python library to download YouTube content and retrieve metadata Python library to download YouTube content and retrieve metadata - GitHub - mps-youtube/pafy: Python library to download YouTube content and retrieve metadata github.com How to use ? 다음과 같이 instance를 선언한 뒤 필요한 정보를 얻을 수 있다. import pafy url = "https://www.youtube.com..
욱근욱
'Python' 카테고리의 글 목록