POExtraction_UC3 / parse_toshiba.py
DSatishchandra's picture
Create parse_toshiba.py
dfc33ee verified
raw
history blame
611 Bytes
import pdfplumber
import pandas as pd
def parse_toshiba_pdf(pdf_path):
columns = [
"Purchase Order", "Order Date", "Pos", "Item Code",
"Description", "Unit", "Delivery Date",
"Quantity", "Basic Price", "Discount", "Cur", "Amount", "Sub Total"
]
data = []
with pdfplumber.open(pdf_path) as pdf:
for page in pdf.pages:
table = page.extract_table()
if table:
for row in table[1:]: # Skip header row
data.append(row)
# Create a DataFrame
df = pd.DataFrame(data, columns=columns)
return df