title: Camelot: table_area and table_regions do not work as expected
body: <p>I have been trying to make Camelot work on specific areas of pdf pages for a good couple of days but it keeps puzzling me. I reviewed and tried the docs suggestions, a few bug reports and <a href="https://stackoverflow.com/questions/53203779/headers-are-not-getting-extracted-from-pdf-while-extracting-the-table-data-from">this SO question</a> to no avail. I could use some help.</p>
  
  <p>I took an example from the docs, since it has more than one table, <a href="https://camelot-py.readthedocs.io/en/master/user/advanced.html#strip-characters-from-text" rel="nofollow noreferrer">this one</a>. I amended the original command to extract only one of the two tables, from:</p>
  
  <p><code>tables = camelot.read_pdf('12s0324.pdf', flavor='stream', strip_text=' .\n')</code></p>
  
  <p>to:</p>
  
  <p><code>tables = camelot.read_pdf('12s0324.pdf', flavor='stream', strip_text='\n', table_area=['33,297,386,65'], pages = '1')</code></p>
  
  <p>Whereas:</p>
  
  <ul>
  <li>I changed the regex because it was eliminating spaces between words,</li>
  <li>used <code>table_area</code> instead of the docs' <code>table_areas</code> because the former triggers the elaboration, while the second an error (the bug is explained <a href="https://github.com/atlanhq/camelot/issues/149#issuecomment-432013529" rel="nofollow noreferrer">here</a>, and the docs still seem to be wrong)</li>
  <li>tried to extract both tables and checked the respective areas using camelot's plot feature as explained in the <a href="https://camelot-py.readthedocs.io/en/master/user/advanced.html#visual-debugging" rel="nofollow noreferrer">docs here</a>, so they <em>should</em> be right,</li>
  <li>tried also using <code>table_regions</code> and at least it pulls one table out instead of two, but it remains rather inaccurate (see comments below)</li>
  </ul>
  
  <p>So here are the results of my trials on the pdf mentioned above:</p>
  
  <p>First one: using <code>table_area</code> on the <code>'35,591,385,343'</code> PDF area (top table)</p>
  
  <pre><code>&gt;&gt;&gt; tables = camelot.read_pdf('12s0324.pdf', flavor='stream', strip_text='\n', table_area=['35,591,385,343'], pages = '1')
  &gt;&gt;&gt; tables
  &lt;TableList n=2&gt;
  &gt;&gt;&gt; tables[0].df
                                                      0                                                  1         2         3         4         5         6         7         8         9
  0   Program. Represents arrests reported (not char...                                                                                                                                   
  1   by the FBI. Some persons may be arrested more ...                                                                                                                                   
  2   could represent multiple arrests of the same p...                                                                                                                                   
  3                                                                                                            Total                          Male                        Female          
  4                                     Offense charged                                                     Under 18  18 years            Under 18  18 years            Under 18  18 years
  5                                                                                                  Total     years  and over     Total     years  and over     Total     years  and over
  6   Total   . . .  .  .  .  .  . .  . .  . .  . . ...                                          11,062 .6  1,540 .0  9,522 .6  8,263 .3  1,071 .6  7,191 .7  2,799 .2    468 .3  2,330 .9
  7   Violent crime   .  .  .  .  .  .  .  . .  . . ...                                             467 .9     69 .1    398 .8    380 .2     56 .5    323 .7     87 .7     12 .6     75 .2
  8                             Murder and nonnegligent                                                                                                                                   
  9           manslaughter . . . . . . . .. .. .. .. ..                                               10.0       0.9       9.1       9.0       0.9       8.1       1.1         –       1.0
  10       Forcible rape . . . . . . . .. .. .. .. .. .                                               17.5       2.6      14.9      17.2       2.5      14.7         –         –         –
  11         Robbery . . . .. .. . .. . ... . ... . ...                                              102.1      25.5      76.6      90.0      22.9      67.1      12.1       2.5       9.5
  ....
  34       Disorderly conduct . .. . . . . . .. .. .. .                                              529.5     136.1     393.3     387.1      90.8     296.2     142.4      45.3      97.1
  35          Vagrancy . . . .. . . . ... .... .... ...                                               26.6       2.2      24.4      20.9       1.6      19.3       5.7       0.6       5.1
  36         All other offenses (except traffic) . . ..                                              306.1     263.4   2,800.8   2,337.1     194.2   2,142.9     727.0      69.2     657.9
  37      Suspicion . . . .. . . .. .. .. .. .. .. . ..                                                1.6         –       1.4       1.2         –       1.0         –         –         –
  38            Curfew and loitering law violations  ..                                               91.0      91.0       (X)      63.1      63.1       (X)      28.0      28.0       (X)
  39        Runaways  . . . . . . . .. .. .. .. .. ....                                               75.8      75.8       (X)      34.0      34.0       (X)      41.8      41.8       (X)
  40                                                     – Represents zero. X Not applicable. 1 Buying,...
  </code></pre>
  
  <p>Notice how the tables are two, and it includes unwanted text both at the top and bottom, which should not be inside the area chosen using <code>plot()</code>.</p>
  
  <p>Second: using <code>table_regions</code> on the same <code>'35,591,385,343'</code> PDF area, top table</p>
  
  <pre><code>&gt;&gt;&gt; tables = camelot.read_pdf('12s0324.pdf', flavor='stream', strip_text='\n', table_regions=['35,591,385,343'], pages = '1')
  &gt;&gt;&gt; tables
  &lt;TableList n=1&gt;
  &gt;&gt;&gt; tables[0].df
                                                      0                                                  1         2         3         4         5         6         7         8         9
  0   Program. Represents arrests reported (not char...                                                                                                                                   
  1   by the FBI. Some persons may be arrested more ...                                                                                                                                   
  2   could represent multiple arrests of the same p...                                                                                                                                   
  3                                                                                                            Total                          Male                        Female          
  4                                     Offense charged                                                     Under 18  18 years            Under 18  18 years            Under 18  18 years
  5                                                                                                  Total     years  and over     Total     years  and over     Total     years  and over
  6   Total   . . .  .  .  .  .  . .  . .  . .  . . ...                                          11,062 .6  1,540 .0  9,522 .6  8,263 .3  1,071 .6  7,191 .7  2,799 .2    468 .3  2,330 .9
  7   Violent crime   .  .  .  .  .  .  .  . .  . . ...                                             467 .9     69 .1    398 .8    380 .2     56 .5    323 .7     87 .7     12 .6     75 .2
  8                             Murder and nonnegligent                                                                                                                                   
  9           manslaughter . . . . . . . .. .. .. .. ..                                               10.0       0.9       9.1       9.0       0.9       8.1       1.1         –       1.0
  10       Forcible rape . . . . . . . .. .. .. .. .. .                                               17.5       2.6      14.9      17.2       2.5      14.7         –         –         –
  11         Robbery . . . .. .. . .. . ... . ... . ...                                              102.1      25.5      76.6      90.0      22.9      67.1      12.1       2.5       9.5
  ....
  34       Disorderly conduct . .. . . . . . .. .. .. .                                              529.5     136.1     393.3     387.1      90.8     296.2     142.4      45.3      97.1
  35          Vagrancy . . . .. . . . ... .... .... ...                                               26.6       2.2      24.4      20.9       1.6      19.3       5.7       0.6       5.1
  36         All other offenses (except traffic) . . ..                                              306.1     263.4   2,800.8   2,337.1     194.2   2,142.9     727.0      69.2     657.9
  37      Suspicion . . . .. . . .. .. .. .. .. .. . ..                                                1.6         –       1.4       1.2         –       1.0         –         –         –
  38            Curfew and loitering law violations  ..                                               91.0      91.0       (X)      63.1      63.1       (X)      28.0      28.0       (X)
  39        Runaways  . . . . . . . .. .. .. .. .. ....                                               75.8      75.8       (X)      34.0      34.0       (X)      41.8      41.8       (X)
  40                                                     – Represents zero. X Not applicable. 1 Buying,... 
  </code></pre>
  
  <p>Just one table, same issue with unwanted text outside the selected area, apparently.</p>
  
  <p>Third: Using <code>table_area</code> on the <code>'33,297,386,65'</code> PDF area (bottom table)</p>
  
  <pre><code>&gt;&gt;&gt; tables = camelot.read_pdf('12s0324.pdf', flavor='stream', strip_text='\n', table_area=['33,297,386,65'], pages = '1')
  &gt;&gt;&gt; tables
  &lt;TableList n=2&gt;
  &gt;&gt;&gt; tables[0].df
                                                      0                                                  1         2         3         4         5         6         7         8         9
  0   Program. Represents arrests reported (not char...                                                                                                                                   
  1   by the FBI. Some persons may be arrested more ...                                                                                                                                   
  2   could represent multiple arrests of the same p...                                                                                                                                   
  3                                                                                                            Total                          Male                        Female          
  4                                     Offense charged                                                     Under 18  18 years            Under 18  18 years            Under 18  18 years
  5                                                                                                  Total     years  and over     Total     years  and over     Total     years  and over
  6   Total   . . .  .  .  .  .  . .  . .  . .  . . ...                                          11,062 .6  1,540 .0  9,522 .6  8,263 .3  1,071 .6  7,191 .7  2,799 .2    468 .3  2,330 .9
  7   Violent crime   .  .  .  .  .  .  .  . .  . . ...                                             467 .9     69 .1    398 .8    380 .2     56 .5    323 .7     87 .7     12 .6     75 .2
  8                             Murder and nonnegligent                                                                                                                                   
  9           manslaughter . . . . . . . .. .. .. .. ..                                               10.0       0.9       9.1       9.0       0.9       8.1       1.1         –       1.0
  10       Forcible rape . . . . . . . .. .. .. .. .. .                                               17.5       2.6      14.9      17.2       2.5      14.7         –         –         –
  11         Robbery . . . .. .. . .. . ... . ... . ...                                              102.1      25.5      76.6      90.0      22.9      67.1      12.1       2.5       9.5
  ....
  34       Disorderly conduct . .. . . . . . .. .. .. .                                              529.5     136.1     393.3     387.1      90.8     296.2     142.4      45.3      97.1
  35          Vagrancy . . . .. . . . ... .... .... ...                                               26.6       2.2      24.4      20.9       1.6      19.3       5.7       0.6       5.1
  36         All other offenses (except traffic) . . ..                                              306.1     263.4   2,800.8   2,337.1     194.2   2,142.9     727.0      69.2     657.9
  37      Suspicion . . . .. . . .. .. .. .. .. .. . ..                                                1.6         –       1.4       1.2         –       1.0         –         –         –
  38            Curfew and loitering law violations  ..                                               91.0      91.0       (X)      63.1      63.1       (X)      28.0      28.0       (X)
  39        Runaways  . . . . . . . .. .. .. .. .. ....                                               75.8      75.8       (X)      34.0      34.0       (X)      41.8      41.8       (X)
  40                                                     – Represents zero. X Not applicable. 1 Buying,...
  </code></pre>
  
  <p>It picks up both tables and clearly the first one remains the top one. Same issue with unwanted text, but it is now expected.</p>
  
  <p>Fourth: Using <code>table_regions</code> on the <code>'33,297,386,65'</code> PDF area (bottom table)</p>
  
  <pre><code>&gt;&gt;&gt; tables = camelot.read_pdf('12s0324.pdf', flavor='stream', strip_text='\n', table_regions=['33,297,386,65'], pages = '1')
  &gt;&gt;&gt; tables
  &lt;TableList n=1&gt;
  &gt;&gt;&gt; tables[0].df
                                                      0           1          2          3               4              5
  0                    Table 325. Arrests by Race: 2009                                                                 
  1   [Based on Uniform Crime Reporting (UCR) Progra...                                                                 
  2   with a total population of 239,839,971 as esti...                                                                 
  3                                                                                              American               
  4                                     Offense charged                                    Indian/Alaskan  Asian Pacific
  5                                                           Total      White      Black          Native       Islander
  6   Total  . . . . .  . .  .  . .  .  . . .  .  . ...  10,690,561  7,389,208  3,027,153         150,544        123,656
  7   Violent crime   .  .  .  .  .  .  .  . .  . . ...     456,965    268,346    177,766           5,608          5,245
  8     Murder and nonnegligent manslaughter . .. ... .       9,739      4,741      4,801             100             97
  9   Forcible rape . . . . . . . .. .. .. .. .... ....      16,362     10,644      5,319             169            230
  10  Robbery . . . . .. . . . ... . ... . .... .......     100,496     43,039     55,742             726            989
  11  Aggravated assault  . . . . . . . .. .. .........     330,368    209,922    111,904           4,613          3,929
  ....
  34  All other offenses (except traffic) . .. .. .....   2,929,217  1,937,221    911,670          43,880         36,446
  35  Suspicion . . .. . . . .. .. .. .. .. .. .. .....       1,513        677        828               1              7
  36  Curfew and loitering law violations  . .. ... ...      89,578     54,439     33,207             872          1,060
  37  Runaways  . . . . . . . .. .. .. .. .. .. .......      73,616     48,343     19,670           1,653          3,950
  38           1 Except forcible rape and prostitution.
  </code></pre>
  
  <p>Better, yet it picks up unwanted text as above.</p>
  
  <p>I would really value suggestions or pointers. Thanks in advance!</p>