Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: module 'camelot' has no attribute 'read_pdf'

I am trying to extract tables from pdf using camelot and I get this attribute error. Could you please help?

import camelot
import pandas as pd
pdf = camelot.read_pdf("Gordian.pdf")

AttributeError Traceback (most recent call last) in ----> 1 pdf = camelot.read_pdf("Gordian.pdf")

AttributeError: module 'camelot' has no attribute 'read_pdf'

like image 652
Yousra Avatar asked Oct 14 '19 12:10

Yousra


2 Answers

Try this: import camelot.io as camelot That worked for me.

like image 187
Chadee Fouad Avatar answered Oct 11 '22 14:10

Chadee Fouad


NOTE : If you are using virtual environment activate environment before do this things.

I have already faced this error.There is a no bug in your code.The problem is with camelot installation.

1 remove installed camelot version

2 install again using this command. There is a multiple ways to install camelot. Please try it one by one

  • pip install camelot-py
  • pip install camelot-py[cv]
  • pip install camelot-py[all]

3 run your code >> i have attached sample code here

import camelot

data = camelot.read_pdf("test_file.pdf", pages='all')
print(data)
like image 32
waruna k Avatar answered Oct 11 '22 15:10

waruna k