#8 Generate bulk PDF reports in Python from a csv file
Generate pdf reports in Python from a single CSV file
CSV files provide a great convenience for collecting and manipulating lots of records in a structured manner. What if you would like to generate some kind of report for each record in a CSV file?
Driving Question
I have a single CSV file with several records. I would like to generate a PDF report for each record in the CSV file using a predefined template. How can I achieve this?
In today’s tutorial, we will extend the power of Python’s string formatting to generate some simple reports using a pre-defined template written in HTML. This tutorial will be based on a simple application for a teacher in the classroom who has exam records for several students all sitting in a single file CSV. We can then use Python and the techniques we learn today to generate some reports for each student without having to do all of this by hand. Today’s tutorial may require a basic understanding of HTML in order for you to create your own custom template. Otherwise, you may need someone to create the template for you to use in your code.
What we will cover today:
0:00 Intro
03:40 Load and inspect data
07:42 Preprocessing
11:50 Quick review of Python string formatting
19:10 A simple template
22:20 A better template using HTML
26:50 Generate PDF Report
Additional References:
This tutorial assumes a basic understanding of Python string formatting. Also, some basic understanding of reading and writing files will be sufficient. For a quick reference, check the resources below:
Python String formatting: https://pyformat.info/
Read and write multiple files to disk: https://www.youtube.com/playlist?list=PLfw6l-hzbtXvhcOO5yJFb3h6yClMW8ktl For a basic understanding of reading and writing data.
Generating Dummy Data in Python: https://www.youtube.com/watch?v=N6GP0csGMio&list=PLfw6l-hzbtXvhcOO5yJFb3h6yClMW8ktl&index=5&t=183s
Source Code
Visit the following GitHub repository to follow along with the code used in this tutorial
https://github.com/quizem/data-skills-for-everyone/tree/main/Basic%20Text%20Processing/%238%20Generate%20bulk%20PDF%20reports%20in%20Python%20from%20a%20csv%20file
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «#8 Generate bulk PDF reports in Python from a csv file», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.