Python/문서 데이터 분석

[Python] Python을 이용한 PDF 파일 정보 추출

데이터 세상 2022. 1. 9. 10:32

PDF 파일 정보 추출을 위한 python 라이브러리들을 소개하고자 한다.

PDF 파일에서 추출하고 싶은 데이터의 구조(텍스트, 테이블 데이터 등)나 Output 형태(이미지 파일, Dataframe 등)에 따라 적합한 라이브러리를 채택하여 데이터를 추출해야 한다.

 

PyPDF2

※ 한글 텍스트가 정상 추출되지 않는다.

[Python/문서 데이터 분석] - PyPDF2

 

PyPDF2

PyPDF2 https://pythonhosted.org/PyPDF2/ PyPDF2 Documentation — PyPDF2 1.26.0 documentation pythonhosted.org PyPDF2 설치 pip install PyPDF2 PyPDF2를 이용한 파일 정보 추출 from PyPDF2 import PdfFileR..

yumdata.tistory.com


PyMuPDF

※ 한글 텍스트가 정상 추출되지만, 테이블 형태의 테이터를 파악하기 어렵다.

[Python/문서 데이터 분석] - PyMuPDF

 

PyMuPDF

PyMuPDF 설치 pip install PyMuPDF PyMuPDF를 이용한 파일 정보 추출 import fitz pdf_doc = fitz.open("sample.pdf") # number of pages print(f"전체 Page 수: {pdf_doc.page_count}") # Get the first page pag..

yumdata.tistory.com


tabula-py

※ PDF 파일 내의 테이블 정보를 pandas의 Dataframe으로 추출할 수 있다.

 

[Python/문서 데이터 분석] - tabula-py

 

tabula-py

tabula-py https://github.com/chezou/tabula-py GitHub - chezou/tabula-py: Simple wrapper of tabula-java: extract table from PDF into pandas DataFrame Simple wrapper of tabula-java: extract table from..

yumdata.tistory.com


Tika-python

이전 발행글의 Tika-python을 참고하여 PDF 파일의 정보를 추출할 수 있다.

[Python/문서 데이터 분석] - tika-python

 

tika-python

tika-python [tika-pyhon @github] GitHub - chrismattmann/tika-python: Tika-Python is a Python binding to the Apache Tika™ REST services allowing Tika to be call Tika-Python is a Python binding to th..

yumdata.tistory.com

 

 


Textract

[Python/문서 데이터 분석] - Textract

 

Textract

Textract 워드, 파워포인트, PDF 파일 등의 텍스트 추출 https://github.com/deanmalmgren/textract GitHub - deanmalmgren/textract: extract text from any document. no muss. no fuss. extract text from any..

yumdata.tistory.com

 

 


References

반응형