POExtraction_UC3 / parse_bhel.py
DSatishchandra's picture
Create parse_bhel.py
ac7dc42 verified
raw
history blame
567 Bytes
import pdfplumber
import pandas as pd
def parse_bhel_pdf(pdf_path):
columns = [
"Purchase Order No", "Date", "Sl No", "Material Description",
"Unit", "Quantity", "Dely Qty", "Dely Date", "Unit Rate", "Value"
]
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