UseCase3 / bhel.py
DSatishchandra's picture
Create bhel.py
80a9287 verified
Raw
History Blame Contribute Delete
522 Bytes
import pdfplumber
import pandas as pd
def extract_bhel_table(pdf_file):
"""Extracts structured tabular data specific to BHEL POs."""
rows = []
with pdfplumber.open(pdf_file) as pdf:
for page in pdf.pages:
table = page.extract_table()
if table:
rows.extend(table[1:]) # Skip header row
columns = ["Sl No", "Material Description", "Unit", "Quantity", "Dely Qty", "Dely Date", "Unit Rate", "Value"]
df = pd.DataFrame(rows, columns=columns)
return df