전체 글
-
정형, 비정형, 반정형Data Engineer 2023. 12. 15. 09:03
정형 데이터 데이터베이스의 정해진 규칙에 맞게 데이터를 들어간 데이터 중에 수치만으로 의미 파악이 쉬운 데이터 정형 데이터는 그 값이 의미를 파악하기 쉽고, 규칙적인 값으로 데이터가 들어갈 경우 정형 데이터라고 한다. id gender 1 1 2 2 3 1 남자가 1, 여자가 2라면, gender 칼럼은 수치만으로 성별을 파악할 수 있으므로 정형 데이터다. 비정형 데이터 정해진 규칙이 없어서 값의 의미를 쉽게 파악하기 힘든 경우로, 텍스트, 음성, 영상과 같은 데이터가 비정형 데이터 범위에 속해있다. 반정형 데이터 HTML과 XML과 같은 포맷을 반정형 데이터의 범위에 넣을 수 있다. 일반적으로 데이터베이스는 아니나 스키마를 가지고 있는 형태를 뜻하며, 데이터베이스의 데이터를 Dump하여 Json이나 X..
-
concurrent.futuresData Engineer 2023. 12. 7. 00:29
현재 수행중인 프로젝트에서 Azure Blob Storage로부터 WAS에 이미지 데이터를 로드해야 하는 데 시간이 너무 오래 걸리는 현상이 발생했다. 로드하는 함수를 직렬 처리를 하는 대신에 병렬로 하면 어떨까하는 의문이 들어서 적용을 해보기로 했다. 그래서 이 참에, python의 병렬 함수 처리를 가능케 하는 모듈에 대해 알아보기로 했다. concurrent.futures 모듈은 비동기적으로 callable을 실행하는 고수준 인터페이스를 제공한다. Python에서 비동기 실행은 Thread 혹은 별도의 Process로 수행된다. 이 때, Thread로 실행되는 ThreadPoolExecutor와 Process로 실행되는 ProcessPoolExecutor가 존재한다. Executor 객체 class..
-
Copy() 메서드Data Engineer 2023. 12. 3. 22:40
기본적으로 얕은 복사를 수행. 얕은 복사는 객체 자체를 복사하지만, 내부 객체(리스트, 딕셔너리)는 참조로 유지 내부 객체까지 새롭게 복사하고 싶은 경우 copy 모듈의 copy.deepcopy() 를 사용해야 한다 복사 작업의 오버헤드 : 많은 양의 데이터를 다루는 경우, copy() 작업이 오버헤드를 초래할 수 있다. 특히 큰 데이터 구조를 자주 복사해야 하는 경우 성능에 영향을 미칠 수 있다. 가비지 컬렉션 및 메모리 사용 : 많은 객체가 생성되면 가비지 컬렉션의 작업이 늘어날 수 있다. 불필요한 객체가 많이 생성되면 메모리 사용량이 증가한다 불변 객체 : 숫자, 문자열과 같은 불변 객체인 경우 copy() 작업은 필요하지 않을 수 있다. 불변 객체는 값을 변경할 수 없기 때문에 일반적으로 복사가 ..
-
동기 작업과 비동기 작업Data Engineer 2023. 12. 3. 22:37
비동기 작업이 필요한 상황은 다음과 같이 다양합니다: 대규모 동시 요청 처리: 실시간 데이터 스트리밍: 웹 소켓 통신: 외부 API 호출: 데이터베이스 작업: 백그라운드 작업: 긴 처리 시간 요청: 이러한 상황에서 비동기 작업을 활용하면 애플리케이션의 성능을 향상시키고 사용자 경험을 개선할 수 있습니다. 동기 작업은 비동기 작업보다 간단하고 직관적인 모델로, 특정 상황에서 여전히 필요하며 유용합니다. 아래는 동기 작업이 필요한 몇 가지 상황입니다. 단순한 작업 처리: 데이터 무결성 유지: 순차적 작업 처리: 단순한 코드 구현: 데이터 무결성 유지: 종료 조건이 필요한 작업: 요약하면, 동기 작업은 간단하고 직관적이며 특히 순차적 작업 처리나 데이터 무결성 유지와 같은 상황에서 필요할 수 있습니다. 하지만..
-
SettingWithCopyWarningComputer Science 2023. 11. 24. 20:05
원천이 되는 DataFrame의 일부로 구성된 파생 DataFrame에 변경을 가하는 경우 발생 왜? Pandas DataFrame은 연쇄적인 연산과 처리를 허용 SQL에서 테이블을 SELECT 한 결과가 다시 테이블이 되어 다시 SELECT할 수 있는 것처럼 DataFrame도 자료구조이기 때문에, 메모리를 점유 Pandas에서는 원천 DataFrame을 생성할 때만 메모리를 할당하고 파생 DataFrame은 원천 데이터프레임을 이미 적재된 메모리에 접근케하며 메모리를 절약 Pandas는 copy() 메서드를 통해 파생 DataFrame에 독립적인 메모리를 부여한 뒤 수정을 가하도록 우도 View랑 무슨 연관관계일까? View는 하나 이사의 기본 테이블이나 다른 뷰를 이용하여 생성되는 가상 테이블이다...
-
Django SignalsDjango 2023. 11. 12. 09:48
Django는 시그널 포착기를 포함한다. Signal dispatcher : 분리된 애플리케이션들이 프레임워크상 어디서든 액션이 발생하면 통지받게끔 함 signal은 sender들에게 하여금 어떤 액션이 발생했다는 것을 receiver들에게 전달하는 것을 가능하게 해준다. *주의! Signal은 느슨한 결합을 제공하지만, 디버깅, 수정이 어려운 코드로 만들어 질 수 있다. 가능하면 신호를 통해 발송하는 것보다는 직접 핸들링 코드를 호출하는 방법을 선택해야 한다. Signal을 받기 위해, receiver는 signal.connect() 메서드를 사용한 리시버 함수를 등록해야 한다. 리시버 함수는 signal을 받았을 때 호출된다. 모든 signal의 리시버 함수들은 등록 순서대로 한번에 한번 호출된다. ..