title: How to extract table content from CSV file after been converted from PDF with Python?
body: <p>I have a PDF that contains many tables. )I converted this PDF to CSV online, to extract the needed data more easily.)</p>
  
  <p>The CSV rows are composed of many columns, but each table contains only 3 columns, so it is hard to know which column refers to a cell. </p>
  
  <p>I also should mention that one cell can be composed of more than one line and column.
  <a href="https://gfi1-my.sharepoint.com/:i:/g/personal/mansour_trabelsi_gfi-tunisie_com/EbD7BEXeg65Mi7ZVt0eqFQUByJ4FzvuFBLm-ugh52hLhdQ?e=WanFJS" rel="nofollow noreferrer">An example of a table</a>.</p>
  
  <p>So is there any solution to extract these cells?</p>
  
  <pre><code>import csv
  import re
  class PDF_EXTRACTOR:
      FILE_NAME=None
      Ttableau=None
      NUMBER_OF_PAGES=None
      def __init__(self,fn):
          self.FILE_NAME=fn
          self.Ttableau=0
          self.NUMBER_OF_PAGES=0
      def EXTRACT_CELLULE(self):
          csv.register_dialect('mydialect',delimiter =',',skipinitialspace=True)
          print(csv.list_dialects())
          with open(self.FILE_NAME,'r',encoding='utf8',errors='ignore') as csvFile:
              reader = csv.reader(csvFile, dialect='mydialect')
              for index, row in enumerate(reader):
                  print(row)
  </code></pre>
  
  <p>I expected an output like this: </p>
  
  <pre><code>["Region 1","Region 2", "Region3]
  ["8,3-9","AUXILIAIRES DE LA MÉTÉOROLOGIE 5.54A 5.54B 5.54C",""]
  ["70-72","70-90","70-72"]
  ["RADIONAVIGATION 5.60","FIXE","MARITIME 5.60"]
  </code></pre>
  
  <p>But instead I got this: </p>
  
  <pre><code>['7 450-8 100', 'FIXE', '', '', '', '']
  ['', 'MOBILE sauf mobile aéronautique (R)', '', '', '', '']
  ['', '5.144', '', '', '', '']
  ['8 100-8 195', 'FIXE', '', '', '', '']
  ['', 'MOBILE MARITIME', '', '', '', '']
  ['8 195-8 815', 'MOBILE MARITIME', '5.109', '5.11', '5.132', '5.145']
  ['', '5.111', '', '', '', '']
  ['8 815-8 965', 'MOBILE AÉRONAUTIQUE (R)', '', '', '', '']
  ['8 965-9 040', 'MOBILE AÉRONAUTIQUE (OR)', '', '', '', '']
  ['9 040-9 305', '9 040-9 400', '', '', '', '9 040-9 305']
  ['FIXE', 'FIXE', '', '', '', 'FIXE']
  ['9 305-9 355', '', '', '', '', '9 305-9 355']
  ['FIXE', '', '', '', '', 'FIXE']
  ['Radiolocalisation 5.145A', '', '', '', '', 'Radiolocalisation 5.145A']
  ['5.145B', '', '', '', '', '']
  ['9 355-9 400', '', '', '', '', '9 355-9 400']
  </code></pre>