Tosamoon
Tosamoon

Reputation: 3

Tabula GUI and Tabula-py give a different outcome

I'm trying to extract some data from a pdf table, I used the Tabula.exe app at the beginning and after selecting the wanted area the resulting csv is how I want it. I exported the template and I tried the same thing with Tabula-py using "read_pdf_with_template", but the result gives some NaN values.

Sarting PDF: pdf portion

Template: template [{"page":3,"extraction_method":"guess","x1":56.99806280517571,"x2":537.6866864624022,"y1":239.22816177368162,"y2":737.7751863098144,"width":480.6886236572265,"height":498.54702453613277}]

Tabula GUI result: gui result

Python code:

df_list = tabula.read_pdf_with_template("Report.pdf", "Report.tabula-template.json" )
df = df_list[0]
print(df)

Python result:

21 dicembre, 24 12:08 135 84 53 21 dicembre, 24 20:27 130
0 21 dicembre, 24 12:53 134.0 82.0 70.0 21 dicembre, 24 21:35 130.0
1 21 dicembre, 24 13:00 136.0 86.0 57.0 21 dicembre, 24 22:56 131.0
2 21 dicembre, 24 14:07 137.0 86.0 65.0 21 dicembre, 24 23:40 135.0
3 21 dicembre, 24 14:15 139.0 89.0 60.0 21 dicembre, 24 23:49 125.0
4 21 dicembre, 24 14:31 132.0 81.0 58.0 21 dicembre, 24 23:57 123.0
5 21 dicembre, 24 15:11 137.0 85.0 60.0 22 dicembre, 24 00:20 121.0
6 21 dicembre, 24 15:19 143.0 89.0 61.0 22 dicembre, 24 00:29 122.0
7 21 dicembre, 24 16:21 124.0 75.0 59.0 22 dicembre, 24 00:37 120.0
8 21 dicembre, 24 16:31 131.0 73.0 58.0 22 dicembre, 24 00:45 123.0
9 21 dicembre, 24 16:40 130.0 77.0 55.0 22 dicembre, 24 00:53 110.0
10 21 dicembre, 24 17:22 136.0 81.0 55.0 22 dicembre, 24 01:34 116.0
11 21 dicembre, 24 17:31 138.0 85.0 58.0 22 dicembre, 24 02:15 125.0
12 21 dicembre, 24 18:12 132.0 76.0 50.0 22 dicembre, 24 02:55 121.0
13 21 dicembre, 24 18:53 133.0 81.0 51.0 22 dicembre, 24 03:03 118.0
14 21 dicembre, 24 19:11 123.0 75.0 50.0 22 dicembre, 24 03:43 119.0
15 21 dicembre, 24 19:20 123.0 76.0 54.0 22 dicembre, 24 04:23 118.0
16 21 dicembre, 24 20:03 135.0 83.0 60.0 NaN NaN NaN
17 NaN NaN NaN NaN 22 dicembre, 24 05:44 125.0
18 5321 dicembre, 24 20:12 131.0 80.0 57.0 22 dicembre, 24 05:53 126.0

76 53.1
0 77.0 57.0
1 78.0 61.0
2 80.0 55.0
3 76.0 53.0
4 71.0 50.0
5 72.0 54.0
6 70.0 49.0
7 70.0 50.0
8 70.0 49.0
9 68.0 49.0
10 69.0 50.0
11 73.0 57.0
12 72.0 51.0
13 71.0 49.0
14 72.0 54.0
15 72.0 52.0
16 NaN NaN
17 78.0 54.0
18 76.0 NaN

I think that could be something related to the fact that one half of the table is not aligned with the other.

Upvotes: 0

Views: 38

Answers (0)

Related Questions