Extracting data from PDF files using Python

Published: 11 February 2022
on channel: YUNIKARN
47,975
594

【Online Courses】
⚡Getting Started with Stata: (24 lectures + 4 assignments = 5.5 hours content): available on Udemy: https://www.udemy.com/course/getting-...

⚡Applied Time Series using Stata (29 lectures + 4 assignments = 6.5 hours content): available on Udemy: https://www.udemy.com/course/applied-...

This is a detailed step-by-step guide that develops a Python code to extract information from PDF files. This is very useful if you have to handle a large number of files. The Python code returns the number of all search term occurrences in the document and identifies the page numbers. All material including the code is on GitHub https://github.com/GerhardKling/DataW...

I introduce the PyPDF2 package, which we need to install.

Installation on Anaconda:
conda install -c conda-forge pypdf2

Installation using the pip installer:
pip install PyPDF2

I show you how to create and activate a virtual environment (which is optional – but useful to do). Then we develop the code step-by-step. This will enable you to learn how to modify the code to suit your specific requirements. Please leave a comment if you have any questions.

Finally, we will refactor the code. We define a function that takes a search term and filename and returns a tuple containing the total number of occurrences and the number of pages that contain the search term at least once.

Chapters
0:00 Welcome
0:15 Return all occurrences & page numbers
0:44 Example PDF
2:23 Python setup
3:55 Virtual environment
6:16 Coding fun
28:05 Refactoring

The channel
YUNIKARN focuses on publishing educational content in applied statistics, mathematics, and data science. In these fields, programming skills have become essential. Hence, we cover various programming languages including Python, Stata, and C++ to tackle problems and for fun.

Stay in touch
Please leave comments or follow us on Twitter (  / gerhardklings  . DMs are open.

Hashtags
#datascience #python #PDF


Watch video Extracting data from PDF files using Python online without registration, duration hours minute second in high quality. This video was added by user YUNIKARN 11 February 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 47,975 once and liked it 594 people.