title: convert text to table in python
body: <p>i'm new to python and pandas and trying to convert a pdf document to a panda dataframe.</p>
  <p>I was able to extract the pdf to a text but not sure how to get the below desired values in the text file to a dictionary</p>
  <p>so far i have used the below code to extract pdf to text as below:</p>
  <pre><code>import pandas as pd
  import pdfplumber
  
  data = './data/coc.pdf'
  
  with pdfplumber.open(data) as pdf:
      page = pdf.pages[0]
      text = page.extract_text()
  
  print(text)
  
  </code></pre>
  <p>Below is the text file</p>
  <pre><code>&quot; \n \nCertificate of Currency \nXYZ Limited \nABN 121011100 54720   AFSL 232111 \n \nAs at Date \n2 November 2015 \nPolicy Information \nPolicy Type \nProfessional  \n \n \nInsured \nUniversity of ABC and others as defined by the policy \ndocument. \n \nInsurer \nMMO Limited   \n                                                    \nPolicy Number(s) \L0K107721013  \n \nPeriod of Insurance \nFrom 4.00pm 1/11/2015 to 4.00pm 1/11/2016 \n \nInterest Insured \nLoss incurred as a result of a civil liability claim made against the insured \nbased solely on the insured’s provision of their professional services  \n \nLimit of Liability \n$20,000,000 any one claim and $60,000,000 in the aggregate for all claims &quot;
  </code></pre>
  <p>Now I like to convert the text file to a dictionary. How can I update the code below with an if condition to create a dictionary that will have key:value pair based on \n or \n\n</p>
  <pre><code>d = dict([i.splitlines() for i in text.split('\n\n')])
  </code></pre>
  <p>I get the below error:</p>
  <p>Error:dictionary update sequence element:</p>
  <p><a href="https://i.stack.imgur.com/yy1K3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yy1K3.png" alt="enter image description here" /></a></p>
  <p><strong>Please find attached desired output table:</strong></p>
  <p>Desired Output:</p>
  <p><a href="https://i.stack.imgur.com/HlGed.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HlGed.png" alt="enter image description here" /></a></p>