-2

I have the following PDF file from which I want to get the the data inside it so as i can integrate with my app.

As an example, i want the data arrange in a row and column

Example i want to get 1 for Monday and 10 and 14 for the columns having white boxes

Here is what I have tried:

 import tabula
 df = tabula.read_pdf("IT.pdf",multiple_tables=True)
 for col in df: 
 print(col)

The output comes like

          07:00 08:00  08:00 09:00  Unnamed: 0  Unnamed: 1  ... Unnamed: 10  07:00 08:00.1 Unnamed: 11  08:00 09:00.1
0            Tutorial     Tutorial         NaN         NaN  ...         NaN       Tutorial         NaN            NaN
1              G1_MSU     G1G2G3_M         NaN         NaN  ...         NaN      SPU_07410         NaN            NaN
2               07201     TU 07203         NaN         NaN  ...         NaN            110         NaN            NaN
3                 110    110, 115,         NaN         NaN  ...         NaN     Andaray, N         NaN            NaN
4        Lema, F (Mr)          117         NaN         NaN  ...         NaN           (Mr)         NaN            NaN
5           BscIRM__1     Farha, M         NaN         NaN  ...         NaN      BIRM__2PT         NaN            NaN
6                   C       (Mrs),         NaN         NaN  ...         NaN            NaN         NaN            NaN
7                 NaN    Mandia, A         NaN         NaN  ...         NaN            NaN         NaN            NaN
8                 NaN        (Ms),         NaN         NaN  ...         NaN            NaN         NaN            NaN
9                 NaN  Wilberth, N         NaN         NaN  ...         NaN            NaN         NaN            NaN
10                NaN         (Ms)         NaN         NaN  ...         NaN            NaN         NaN            NaN
11                NaN    BscIRM__1         NaN         NaN  ...         NaN            NaN         NaN            NaN
12                NaN            C         NaN         NaN  ...         NaN            NaN         NaN            NaN
13           Tutorial     Tutorial         NaN         NaN  ...         NaN       Tutorial         NaN       Tutorial
14             G4_MSU       G3_MTU         NaN         NaN  ...         NaN      AFT_05204         NaN      BFT_05202
15              07201        07203         NaN         NaN  ...         NaN            110         NaN            110
b.john
  • 773
  • 1
  • 6
  • 9
  • So what did you try to solve it? – Yunus Temurlenk Mar 13 '20 at 13:28
  • am new to python, i tried i tried opencv to create lines first. but i got stack. Help please – b.john Mar 13 '20 at 13:31
  • @b.john , please update your question and put what you already have tried. I updated your question accordingly, so you can follow the "template". – r_e Mar 13 '20 at 13:33
  • Analyzing a pdf with opencv seems like a bad idea to me. With pdf you already have structured data, which you only need to parse. A quick search gave me [this](https://github.com/pdfminer/pdfminer.six) for example – user8408080 Mar 13 '20 at 13:40

1 Answers1

1

use camelot package. That will help you.