Python Virtual Environment
--------------------------------------------------
Prerequisites
python3 -m venv venv
source venv/bin/activate

pip3 install --upgrade pip
pip3 install apache-airflow

# show what packages are required for the specified package
pip3 show apache-airflow 
pip3 install apache-airflow --upgrade

pip3 freeze > requirements.txt
pip3 install -r "requirements.txt"
pip3 list
pip3 uninstall -r requirements.txt -y : 전체 pip3 list삭제

Python Tricks

파이썬의 메모리 관리

정렬 알고리즘

faster python

intermediate python

better python

test python

OOP python

Spark

ETL in python

파이썬 기본 데이터 구조

파이썬에서는 데이터, 함수, 클래스, 모듈, 패키지 등을 모두 힙에서 생성되는 객체(object)로 취급한다. 객체는 자료형(data type)을 가지며 메모리(저장 공간)을 차지한다. 파이썬의 변수는 객체를 참조하는(pointer) 객체에 연결된 이름에 불과.

n = 10
print(id(10))  # 4362456080
print(id(n))   # 4362456080

Untitled

파이썬에서 기본 데이터 타입의 크기는 다른 언어에 비해 상대적으로 크다. 이는 파이썬의 동적 타입 시스템과 객체 지향 특성 때문에 메타데이터를 저장하기 위한 추가적인 오버헤드가 있기 때문.