[Tutor] Parsing dictionary to Match headers with values

Joao Carlos Silva de Oliveira Matos joao.oliveira at ufob.edu.br
Sun Mar 21 18:04:22 EDT 2021


Hello everyone,

This is my first time posting, so I apologize if I'm doing something wrong.
So, I am parsing a pdf file using the "PDF READER" package. It's going
really well and I'm very impressed with this library.

Now, I'm trying to match the keys with their values. Here's the logic: A
key can be recognized when the column  "Fonte" has a value equal to F1. The
values can be known when the column "Fonte" has a value equal to F2.

In order to match those values, you need to look at Column X and match them
by their coordinate. There are two problems. The first one is to
concatenate values that have Font F2 and the same coordinate (See green
arrows).

The second problem is to break the loop when another F1 value is found
since we don't want to get other keys.

In my code, I have a dictionary, but I turned it into a data frame so Yu
can see the logic with visual help.

TL;DR: I want to creating a dictionary from a PDF file matching their keys
with their values. But I have to break it before another dictionary comes
along.

[image: image.png]

Here it follows a print of the dictionary:
[image: image.png]
--


More information about the Tutor mailing list