0

一連の PDF ファイルからテーブルを抽出しようとしていますが、tabula-py を機能させることができません。Windows OSのJupyter Notebookで使用しようとしています。残念ながら、私は同じようになっています

「FileNotFoundError」</p>

read_PDF() を使用しようとするたびに。

これまでオンラインで見つけたものから、Tabula Java ファイルを実行しようとしたときにエラーが発生したようです。Javaを正しくインストールしました。

これに関するヘルプは大歓迎です。

これは私が実行しようとしているコードです:

    from tabula import read_pdf
    df = read_pdf("https://github.com/tabulapdf/tabula-java/raw/master/src/test/resources/technology/tabula/arabic.pdf")

エラーメッセージ:

    FileNotFoundError                         Traceback (most recent call last)
    <ipython-input-78-956ad4697ff7> in <module>()
          1 from tabula import read_pdf
    ----> 2 df = read_pdf("https://github.com/tabulapdf/tabula-java/raw/master/src/test/resources/technology/tabula/arabic.pdf")

    C:\Program Files\Anaconda3\lib\site-packages\tabula\wrapper.py in read_pdf(input_path, **kwargs)
         64 
         65     try:
    ---> 66         output = subprocess.check_output(args)
         67     finally:
         68         if is_url:

    C:\Program Files\Anaconda3\lib\subprocess.py in check_output(timeout, *popenargs, **kwargs)
        624 
        625     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    --> 626                **kwargs).stdout
        627 
        628 

    C:\Program Files\Anaconda3\lib\subprocess.py in run(input, timeout, check, *popenargs, **kwargs)
        691         kwargs['stdin'] = PIPE
        692 
    --> 693     with Popen(*popenargs, **kwargs) as process:
        694         try:
        695             stdout, stderr = process.communicate(input, timeout=timeout)

    C:\Program Files\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds)
        945                                 c2pread, c2pwrite,
        946                                 errread, errwrite,
    --> 947                                 restore_signals, start_new_session)
        948         except:
        949             # Cleanup if the child failed starting.

    C:\Program Files\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
       1222                                          env,
       1223                                          cwd,
    -> 1224                                          startupinfo)
       1225             finally:
       1226                 # Child is launched. Close the parent's copy of those pipe
4

6 に答える 6

2

私はこのようにして、コードを実行します

  1. pip install tabula-py

  2. conda install tabula-py

  3. conda install java
  4. from tabula import read_pdf
  5. import pandas as pd
  6. dt = read_pdf('file.pdf', encoding = 'latin1', pages ='all', nospreadsheet = True)

頑張って..

于 2020-01-27T06:38:34.467 に答える
0

PDFファイルが見つからないので。そのため、まず絶対パスまたは相対パスを指定して PDF ファイルを探します。

import os
print(os.getcwd())
print(os.listdir('Other'))

#Locating PDF file with searching and then joining absolute and relative path
file = os.path.join(os.getcwd(), 'test.pdf')
于 2020-10-17T17:20:19.160 に答える