<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tabula | Democratizing Data</title><link>https://b94feae1.chezo-uno.pages.dev/categories/tabula/</link><atom:link href="https://b94feae1.chezo-uno.pages.dev/categories/tabula/index.xml" rel="self" type="application/rss+xml"/><description>Tabula</description><generator>Hugo Blox Builder (https://hugoblox.com)</generator><language>en-us</language><copyright>© Aki Ariga 2017-2025</copyright><lastBuildDate>Mon, 18 Feb 2019 01:26:00 +0900</lastBuildDate><image><url>https://b94feae1.chezo-uno.pages.dev/media/icon_hu_9ca82a90e0d162db.png</url><title>Tabula</title><link>https://b94feae1.chezo-uno.pages.dev/categories/tabula/</link></image><item><title>A recent update of tabula-py</title><link>https://b94feae1.chezo-uno.pages.dev/blog/2019-02-18_a-recent-update-of-tabula-py-a923d2ab667b/</link><pubDate>Mon, 18 Feb 2019 01:26:00 +0900</pubDate><guid>https://b94feae1.chezo-uno.pages.dev/blog/2019-02-18_a-recent-update-of-tabula-py-a923d2ab667b/</guid><description>&lt;p>&lt;figure>&lt;img src="https://b94feae1.chezo-uno.pages.dev/blog/2019-02-18_a-recent-update-of-tabula-py-a923d2ab667b/0__9HRqzqcWldOqKJCK.jpg">&lt;figcaption>
&lt;h4>Photo by [Joshua Rawson-Harris](https://unsplash.com/@joshrh19?utm_source=medium&amp;amp;utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral)&lt;/h4>
&lt;/figcaption>
&lt;/figure>
Photo by &lt;a href="https://unsplash.com/@joshrh19?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener">Joshua Rawson-Harris&lt;/a> on &lt;a href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener">Unsplash&lt;/a>&lt;/p>
&lt;p>&lt;em>This article is&lt;/em> &lt;a href="https://www.patreon.com/posts/23407263" target="_blank" rel="noopener">&lt;em>a repost of Patreon article&lt;/em>&lt;/a> &lt;em>published last December. I’m planning to bump up the next version of tabula-py within few weeks.&lt;/em>&lt;/p>
&lt;div class="flex px-4 py-3 mb-6 rounded-md bg-primary-100 dark:bg-primary-900">
&lt;span class="pr-3 pt-1 text-primary-600 dark:text-primary-300">
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z"/>&lt;/svg>
&lt;/span>
&lt;span class="dark:text-neutral-300">(Note: Oct 7th, 2019)
As of Oct. 2019, I launched &lt;a href="https://tabula-py.readthedocs.io/en/latest/" target="_blank" rel="noopener">a documentation site&lt;/a> and &lt;a href="https://colab.research.google.com/github/chezou/tabula-py/blob/master/examples/tabula_example.ipynb" target="_blank" rel="noopener">Google Colab notebook&lt;/a> for tabula-py. The FAQ would be good place to execute accurate extraction.&lt;/span>
&lt;/div>
&lt;p>This is my first post on patreon. Apologies for delayed announcement of recent update of tabula-py. I will introduce the key features of updates.&lt;/p>
&lt;h3 id="use-tabula-apptemplate">Use Tabula app template&lt;/h3>
&lt;p>Tabula app has &lt;a href="https://github.com/tabulapdf/tabula/pull/711" target="_blank" rel="noopener">&lt;strong>template exporting&lt;/strong>&lt;/a> feature to reuse same bounding box for extraction. tabula-py now load and extract with tabula app’s template.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-py" data-lang="py">&lt;span class="line">&lt;span class="cl">&lt;span class="n">dfs&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">tabula&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">read_pdf_with_template&lt;/span>&lt;span class="p">(&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s1">&amp;#39;./examples/data.pdf&amp;#39;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s1">&amp;#39;./examples/data.tabula-template.json&amp;#39;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">pandas_options&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="p">{&lt;/span>&lt;span class="s1">&amp;#39;header&amp;#39;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">0&lt;/span>&lt;span class="p">})&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="support-file-like-object">Support file-like object&lt;/h3>
&lt;p>Like many python libraries, tabula-py has been able to &lt;a href="https://github.com/chezou/tabula-py/pull/105" target="_blank" rel="noopener">&lt;strong>extract from file-like object&lt;/strong>&lt;/a>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-py" data-lang="py">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># With file-like object &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">pdf&lt;/span>\&lt;span class="n">_path&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="err">‘&lt;/span>&lt;span class="n">tests&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">resources&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">data&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">pdf&lt;/span>&lt;span class="err">’&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">with&lt;/span> &lt;span class="nb">open&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">pdf&lt;/span>\&lt;span class="n">_path&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="err">‘&lt;/span>&lt;span class="n">rb&lt;/span>&lt;span class="err">’&lt;/span>&lt;span class="p">)&lt;/span> &lt;span class="k">as&lt;/span> &lt;span class="n">f&lt;/span>&lt;span class="p">:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">df&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">tabula&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">read_pdf&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">f&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># With pathlib &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">pathlib&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">Path&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">pdf_path&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s1">&amp;#39;tests/resources/data.pdf&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">df&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">tabula&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">read_pdf&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">Path&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">pdf_path&lt;/span>&lt;span class="p">))&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="allow-multiple-areaoption">Allow multiple area option&lt;/h3>
&lt;p>As of tabula-java v1.0.2, tabula can handle multiple area option.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-py" data-lang="py">&lt;span class="line">&lt;span class="cl">&lt;span class="n">pdf_path&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s1">&amp;#39;tests/resources/MultiColumn.pdf&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Relative area &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">df_relative&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">tabula&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">read_pdf&lt;/span>&lt;span class="p">(&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">pdf_path&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">pages&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="mi">1&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">area&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="p">[[&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">0&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">100&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">50&lt;/span>&lt;span class="p">],&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">50&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">100&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">100&lt;/span>&lt;span class="p">]],&lt;/span> &lt;span class="n">relative_area&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="kc">True&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Absolute area &lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">df_absolute&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">tabula&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">read_pdf&lt;/span>&lt;span class="p">(&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">pdf_path&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">pages&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="mi">1&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">area&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="p">[[&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">0&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">451&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">212&lt;/span>&lt;span class="p">],&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">212&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">451&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">425&lt;/span>&lt;span class="p">]])&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="tip-get-tableposition">Tip: Get table position&lt;/h3>
&lt;p>This is not a new feature, but I think it might be helpful for some PDFs.&lt;br>
Detailed post: &lt;a href="https://github.com/chezou/tabula-py/issues/102" target="_blank" rel="noopener">&lt;strong>https://github.com/chezou/tabula-py/issues/102&lt;/strong>&lt;/a>&lt;/p>
&lt;p>&lt;code>read_pdf&lt;/code> with JSON contains position info, so you can get the table position as follows:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-py" data-lang="py">&lt;span class="line">&lt;span class="cl">&lt;span class="n">In&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="mi">5&lt;/span>&lt;span class="p">]:&lt;/span> &lt;span class="n">tables&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">read_pdf&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s2">&amp;#34;./examples/data.pdf&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">output_format&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;json&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">page&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="mi">2&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">In&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="mi">9&lt;/span>&lt;span class="p">]:&lt;/span> &lt;span class="n">top&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">tables&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">][&lt;/span>&lt;span class="s1">&amp;#39;top&amp;#39;&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">In&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="mi">10&lt;/span>&lt;span class="p">]:&lt;/span> &lt;span class="n">left&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">tables&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">][&lt;/span>&lt;span class="s1">&amp;#39;left&amp;#39;&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">In&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="mi">11&lt;/span>&lt;span class="p">]:&lt;/span> &lt;span class="n">bottom&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">tables&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">][&lt;/span>&lt;span class="s1">&amp;#39;height&amp;#39;&lt;/span>&lt;span class="p">]&lt;/span> &lt;span class="o">+&lt;/span> &lt;span class="n">top&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">In&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="mi">12&lt;/span>&lt;span class="p">]:&lt;/span> &lt;span class="n">right&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">tables&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">][&lt;/span>&lt;span class="s1">&amp;#39;width&amp;#39;&lt;/span>&lt;span class="p">]&lt;/span> &lt;span class="o">+&lt;/span> &lt;span class="n">left&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">In&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="mi">13&lt;/span>&lt;span class="p">]:&lt;/span> &lt;span class="n">top&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">bottom&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">left&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">right&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">Out&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="mi">13&lt;/span>&lt;span class="p">]:&lt;/span> &lt;span class="p">(&lt;/span>&lt;span class="mf">0.0&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mf">528.8800048828125&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mf">0.0&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mf">564.8800048828125&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If you have any question, ask on &lt;a href="https://stackoverflow.com/search?q=tabula-py" target="_blank" rel="noopener">&lt;strong>Stack Overflow&lt;/strong>&lt;/a>!&lt;/p>
&lt;h3 id="other-tabula-py-articles">Other tabula-py articles&lt;/h3>
&lt;ul>
&lt;li>&lt;a href="https://blog.chezo.uno/tabula-py-extract-table-from-pdf-into-python-dataframe-6c7acfa5f302" target="_blank" rel="noopener">https://blog.chezo.uno/tabula-py-extract-table-from-pdf-into-python-dataframe-6c7acfa5f302&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://blog.chezo.uno/tabula-py-extract-table-from-pdf-into-python-dataframe-6c7acfa5f302" target="_blank" rel="noopener">https://blog.chezo.uno/tabula-py-extract-table-from-pdf-into-python-dataframe-6c7acfa5f302&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>tabula-py now able to extract remote PDF and multiple tables at once</title><link>https://b94feae1.chezo-uno.pages.dev/blog/2017-05-28_tabula-py-now-able-to-extract-remote-pdf-and-multiple-tables-at-once-6108e24ac07c/</link><pubDate>Sun, 28 May 2017 11:18:39 +0900</pubDate><guid>https://b94feae1.chezo-uno.pages.dev/blog/2017-05-28_tabula-py-now-able-to-extract-remote-pdf-and-multiple-tables-at-once-6108e24ac07c/</guid><description>&lt;div class="flex px-4 py-3 mb-6 rounded-md bg-primary-100 dark:bg-primary-900">
&lt;span class="pr-3 pt-1 text-primary-600 dark:text-primary-300">
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z"/>&lt;/svg>
&lt;/span>
&lt;span class="dark:text-neutral-300">(Note: Oct 7th, 2019)
As of Oct. 2019, I launched &lt;a href="https://tabula-py.readthedocs.io/en/latest/" target="_blank" rel="noopener">a documentation site&lt;/a> and &lt;a href="https://colab.research.google.com/github/chezou/tabula-py/blob/master/examples/tabula_example.ipynb" target="_blank" rel="noopener">Google Colab notebook&lt;/a> for tabula-py. The FAQ would be good place to execute accurate extraction.&lt;/span>
&lt;/div>
&lt;p>tabula-py is a Python library which enables you to extract tables from PDF into pandas DataFrames. Today, I released v0.8.0. In this post, I will introduce improvements after previous post of tabula-py. If you don’t familiar with tabula-py, you can see previous one.&lt;/p>
&lt;div class="iframely-embed">&lt;div class="iframely-responsive" style="height: 140px; padding-bottom: 0;">&lt;a href="https://chezo.uno/blog/2017-01-09_tabula-py--extract-table-from-pdf-into-python-dataframe-6c7acfa5f302/" data-iframely-url="//iframely.net/WEoEyU7">&lt;/a>&lt;/div>&lt;/div>&lt;script async src="//iframely.net/embed.js" charset="utf-8">&lt;/script>
&lt;h3 id="change-notes">Change Notes&lt;/h3>
&lt;ul>
&lt;li>Able to read remote PDF passing URL&lt;/li>
&lt;li>\[Experimental\] Add &lt;code>multiple_tables&lt;/code> mode&lt;/li>
&lt;li>Add batch conversion method:&lt;code>convert_into_by_batch()&lt;/code>&lt;/li>
&lt;li>Add &lt;code>encoding&lt;/code> option&lt;/li>
&lt;li>Add &lt;code>java_options&lt;/code>&lt;/li>
&lt;li>Will deprecate &lt;code>read_pdf_table()&lt;/code> method&lt;/li>
&lt;/ul>
&lt;p>I will explain important features.&lt;/p>
&lt;h4 id="read-remote-pdf-passingurl">Read remote PDF passing URL&lt;/h4>
&lt;p>If you want extract a DataFrame from the internet, you can extract remote PDF without downloading it manually.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-py" data-lang="py">&lt;span class="line">&lt;span class="cl">&lt;span class="n">read_pdf&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s2">&amp;#34;https://github.com/tabulapdf/tabula-java/raw/master/src/test/resources/technology/tabula/12s0324.pdf&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="add-multiple_tables-mode">\[Experimental\] Add &amp;ldquo;&lt;code>multiple_tables&amp;quot;&lt;/code> mode&lt;/h4>
&lt;p>tabula-py is a simple wrapper of tabula-java, it was hard to handle multiple tables in a page. But now, you can extract multiple tables in a page using &lt;code>multiple_tables&lt;/code> option.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-py" data-lang="py">&lt;span class="line">&lt;span class="cl">&lt;span class="n">read_pdf&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s1">&amp;#39;tests/resources/data.pdf&amp;#39;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">pages&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="mi">2&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">multiple_tables&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="kc">True&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This function create a list of DataFrames via JSON from tabula-java, so if tabula-java’s JSON format will change, the output could be broken. If you see &lt;code>CParserError&lt;/code> , try to set &lt;code>multiple_tables&lt;/code> option.&lt;/p>
&lt;h4 id="add-batch-conversion-method-convert_into_by_batch">Add batch conversion method: &amp;ldquo;&lt;code>convert_into_by_batch()&amp;quot;&lt;/code>&lt;/h4>
&lt;p>After tabula-java v0.9.2, we can extract tables from PDF by batch. You can use this function through &lt;code>convert_into_by_batch()&lt;/code> method.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-py" data-lang="py">&lt;span class="line">&lt;span class="cl">&lt;span class="n">convert_into_by_batch&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">path_to_dir&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">output_format&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s1">&amp;#39;csv&amp;#39;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You should set directory path of PDFs, not the specific pdf path.&lt;/p>
&lt;p>tabula-py extracts tables same directory as input files.&lt;/p>
&lt;h3 id="todos">TODOs&lt;/h3>
&lt;p>There are several problems those may be fixed after releasing of tabula-java 0.9.3. e.g) Handling embedded font, including Japanese…&lt;/p>
&lt;h3 id="waiting-for-your-collaboration">Waiting for your collaboration!&lt;/h3>
&lt;p>If you have any troubles with tabula-py, please file &lt;a href="https://github.com/chezou/tabula-py/issues" target="_blank" rel="noopener">an issue on GitHub&lt;/a>. I don’t want to receive emails because the answer will not share to other people. Make sure fill &lt;a href="https://github.com/chezou/tabula-py/blob/master/.github/ISSUE_TEMPLATE.md" target="_blank" rel="noopener">the issue template&lt;/a>, it will reduce many costs for me to solve the problem.&lt;/p>
&lt;h4 id="other-tabula-py-articles">Other tabula-py articles&lt;/h4>
&lt;ul>
&lt;li>&lt;a href="https://blog.chezo.uno/tabula-py-extract-table-from-pdf-into-python-dataframe-6c7acfa5f302" target="_blank" rel="noopener">https://blog.chezo.uno/tabula-py-extract-table-from-pdf-into-python-dataframe-6c7acfa5f302&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://blog.chezo.uno/a-recent-update-of-tabula-py-a923d2ab667b" target="_blank" rel="noopener">https://blog.chezo.uno/a-recent-update-of-tabula-py-a923d2ab667b&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>tabula-py: Extract table from PDF into Python DataFrame</title><link>https://b94feae1.chezo-uno.pages.dev/blog/2017-01-09_tabula-py--extract-table-from-pdf-into-python-dataframe-6c7acfa5f302/</link><pubDate>Mon, 09 Jan 2017 14:09:08 +0900</pubDate><guid>https://b94feae1.chezo-uno.pages.dev/blog/2017-01-09_tabula-py--extract-table-from-pdf-into-python-dataframe-6c7acfa5f302/</guid><description>&lt;div class="flex px-4 py-3 mb-6 rounded-md bg-primary-100 dark:bg-primary-900">
&lt;span class="pr-3 pt-1 text-primary-600 dark:text-primary-300">
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z"/>&lt;/svg>
&lt;/span>
&lt;span class="dark:text-neutral-300">&lt;p>(Oct 7th, 2019)
As of Oct. 2019, I launched a &lt;a href="https://tabula-py.readthedocs.io/en/latest/" target="_blank" rel="noopener">documentation site&lt;/a> and &lt;a href="https://colab.research.google.com/github/chezou/tabula-py/blob/master/examples/tabula_example.ipynb" target="_blank" rel="noopener">Google Colab notebook&lt;/a> for tabula-py. The FAQ would be good place to execute accurate extraction.&lt;/p>
&lt;p>Screenshots in this article is based on the old version interface. See the latest version example in the Colab notebook.&lt;/p>
&lt;/span>
&lt;/div>
&lt;p>Today, I released tabula-py 0.3.0, which extracts table from PDF into Python pandas’s DataFrame.&lt;/p>
&lt;div class="iframely-embed">&lt;div class="iframely-responsive" style="height: 140px; padding-bottom: 0;">&lt;a href="https://github.com/chezou/tabula-py" data-iframely-url="//iframely.net/0WmgXWY?card=small">&lt;/a>&lt;/div>&lt;/div>&lt;script async src="//iframely.net/embed.js" charset="utf-8">&lt;/script>
&lt;p>It is simple wrapper of &lt;a href="https://github.com/tabulapdf/tabula-java" target="_blank" rel="noopener">tabula-java&lt;/a> and it enables you to extract table into DataFrame or JSON with Python. You also can extract tables from PDF into CSV, TSV or JSON file.&lt;/p>
&lt;p>&lt;a href="http://tabula.technology/" target="_blank" rel="noopener">tabula&lt;/a> is a tool to extract tables from PDFs. It is GUI based software, but tabula-java is a tool based on CUI. Though there were &lt;a href="http://github.com/tabulapdf/tabula-extractor" target="_blank" rel="noopener">Ruby&lt;/a>, &lt;a href="https://github.com/leeper/tabulizer" target="_blank" rel="noopener">R&lt;/a>, and &lt;a href="https://github.com/ezodude/tabula-js" target="_blank" rel="noopener">Node.js&lt;/a> bindings of tabula-java, before tabula-py there isn’t any Python binding of it. I believe PyData is a great ecosystem for data analysis and that’s why I created tabula-py. If you are familiar with R, I highly recommend to use &lt;a href="https://github.com/leeper/tabulizer" target="_blank" rel="noopener">tabulizer&lt;/a>, which has the most richest bindings including rich GUI.&lt;/p>
&lt;p>You can install tabula-py via pip:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">pip install tabula-py
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>With tabula-py, you can get DataFrame with &lt;code>read_pdf()&lt;/code> method.&lt;/p>
&lt;p>&lt;figure>&lt;img src="https://b94feae1.chezo-uno.pages.dev/blog/2017-01-09_tabula-py--extract-table-from-pdf-into-python-dataframe-6c7acfa5f302/1_w0uPTg2qfvBbmHYEYxqjYw.png">&lt;figcaption>
&lt;h4>example of read_pdf()&lt;/h4>
&lt;/figcaption>
&lt;/figure>
example of &lt;code>read_pdf()&lt;/code>&lt;/p>
&lt;p>You can also extract tables as JSON format:&lt;/p>
&lt;p>&lt;figure>&lt;img src="https://b94feae1.chezo-uno.pages.dev/blog/2017-01-09_tabula-py--extract-table-from-pdf-into-python-dataframe-6c7acfa5f302/1_wtSMgtCmBgy15PdP6Lq_jQ.png">&lt;figcaption>
&lt;h4>example of JSON&lt;/h4>
&lt;/figcaption>
&lt;/figure>
example of JSON&lt;/p>
&lt;p>You can extract tables into a file like JSON, CSV or TSV with &lt;code>convert_into()&lt;/code> method.&lt;/p>
&lt;p>
&lt;figure >
&lt;div class="flex justify-center ">
&lt;div class="w-100" >&lt;img alt="" srcset="
/blog/2017-01-09_tabula-py--extract-table-from-pdf-into-python-dataframe-6c7acfa5f302/1_tLQ2aqjM_zD_Ls6qNY6E0g_hu_ca877ac8f5d75b14.webp 400w,
/blog/2017-01-09_tabula-py--extract-table-from-pdf-into-python-dataframe-6c7acfa5f302/1_tLQ2aqjM_zD_Ls6qNY6E0g_hu_88b5f6897caa8e4d.webp 760w,
/blog/2017-01-09_tabula-py--extract-table-from-pdf-into-python-dataframe-6c7acfa5f302/1_tLQ2aqjM_zD_Ls6qNY6E0g_hu_d7d0252d9cdad450.webp 1200w"
src="https://b94feae1.chezo-uno.pages.dev/blog/2017-01-09_tabula-py--extract-table-from-pdf-into-python-dataframe-6c7acfa5f302/1_tLQ2aqjM_zD_Ls6qNY6E0g_hu_ca877ac8f5d75b14.webp"
width="760"
height="334"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;figure >
&lt;div class="flex justify-center ">
&lt;div class="w-100" >&lt;img alt="" srcset="
/blog/2017-01-09_tabula-py--extract-table-from-pdf-into-python-dataframe-6c7acfa5f302/1_ir9O2abAz1emEUdVqiwT0Q_hu_6e11e3bb296b938a.webp 400w,
/blog/2017-01-09_tabula-py--extract-table-from-pdf-into-python-dataframe-6c7acfa5f302/1_ir9O2abAz1emEUdVqiwT0Q_hu_b14d35397c1a8cc9.webp 760w,
/blog/2017-01-09_tabula-py--extract-table-from-pdf-into-python-dataframe-6c7acfa5f302/1_ir9O2abAz1emEUdVqiwT0Q_hu_bd8c5a0bf6e5729f.webp 1200w"
src="https://b94feae1.chezo-uno.pages.dev/blog/2017-01-09_tabula-py--extract-table-from-pdf-into-python-dataframe-6c7acfa5f302/1_ir9O2abAz1emEUdVqiwT0Q_hu_6e11e3bb296b938a.webp"
width="760"
height="304"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p>You can see more examples in Jupyter notebook.&lt;/p>
&lt;div class="iframely-embed">&lt;div class="iframely-responsive" style="height: 140px; padding-bottom: 0;">&lt;a href="https://github.com/chezou/tabula-py/blob/master/examples/tabula_example.ipynb" data-iframely-url="//iframely.net/yCWTraF?card=small">&lt;/a>&lt;/div>&lt;/div>&lt;script async src="//iframely.net/embed.js" charset="utf-8">&lt;/script>
&lt;p>I hope you will enjoy data wrangling with tabula-py. Any feedback would be welcome!&lt;/p>
&lt;h3 id="waiting-for-your-collaboration">Waiting for your collaboration!&lt;/h3>
&lt;p>If you have any trouble with tabula-py, please file &lt;a href="https://github.com/chezou/tabula-py/issues" target="_blank" rel="noopener">an issue on GitHub&lt;/a>. I don’t want to receive emails because the answer will not share with other people. Make sure to fill &lt;a href="https://github.com/chezou/tabula-py/blob/master/.github/ISSUE_TEMPLATE.md" target="_blank" rel="noopener">the issue template&lt;/a>, it will reduce many costs for me to solve the problem. Or, I also check StackOverflow. You can ask about it.&lt;/p>
&lt;h4 id="other-tabula-py-articles">Other tabula-py articles&lt;/h4>
&lt;ul>
&lt;li>&lt;a href="https://blog.chezo.uno/tabula-py-now-able-to-extract-remote-pdf-and-multiple-tables-at-once-6108e24ac07c" target="_blank" rel="noopener">https://blog.chezo.uno/tabula-py-now-able-to-extract-remote-pdf-and-multiple-tables-at-once-6108e24ac07c&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://blog.chezo.uno/a-recent-update-of-tabula-py-a923d2ab667b" target="_blank" rel="noopener">https://blog.chezo.uno/a-recent-update-of-tabula-py-a923d2ab667b&lt;/a>&lt;/li>
&lt;/ul></description></item></channel></rss>