Convert PDF of Kumamoto Prefecture Go To EAT member store list to CSV

Convert PDF of member store list of GoToEat Campaign Kumamoto to CSV

command

wget https://gotoeat-kumamoto.jp/pdf/shoplist.pdf -O data.pdf

apt install python3-tk ghostscript
pip install camelot-py[cv]

camelot -p all -o data.csv -f csv -split lattice -scale 40 data.pdf

Python

import camelot
import pandas as pd

tables = camelot.read_pdf("data.pdf", pages="all", split_text=True, strip_text=" \n", line_scale=40)

dfs = [table.df for table in tables]

df_tmp = pd.concat(dfs)

df = df_tmp.iloc[1:].set_axis(df_tmp.iloc[0].to_list(), axis=1).reset_index(drop=True)
df.sort_values(by=["Postal code", "Town area, street address"], inplace=True)

df.to_csv("kumamoto.csv", encoding="utf_8_sig")

Recommended Posts

Convert PDF of Kumamoto Prefecture Go To EAT member store list to CSV
Convert PDF of Chiba Prefecture Go To EAT member store list to CSV (command)
Convert PDF of list of Go To EAT member stores in Niigata prefecture to CSV
Convert PDF of Go To EAT member stores in Ishikawa prefecture to CSV
Convert PDF of Go To Eat Hokkaido campaign dealer list to CSV
Convert PDF of available stores of Go To EAT in Kagoshima prefecture to CSV
Scraping the list of Go To EAT member stores in Fukuoka prefecture and converting it to CSV
Scraping the list of Go To EAT member stores in Niigata prefecture and converting it to CSV
Scraping the member stores of Go To EAT in Osaka Prefecture and converting them to CSV
Convert PDF of new corona outbreak case in Aichi prefecture to CSV
Convert from PDF to CSV with pdfplumber
The story of creating a store search BOT (AI LINE BOT) for Go To EAT in Chiba Prefecture (2) [Overview]
COCO'S Breakfast Buffet List PDF Converted to CSV
Convert a slice object to a list of index numbers
[Python] Convert PDF text to CSV page by page (2/24 postscript)
Convert PDF of Sagamihara City presentation materials (occurrence status, etc.) regarding new coronavirus infection to CSV
Convert PDF of the progress of the division of labor (trends in insurance dispensing) of the Japan Pharmaceutical Association to CSV
[Python] Convert list to Pandas [Pandas]
Convert SDF to CSV quickly
Convert a large number of PDF files to text files using pdfminer