📊
Extracción completada

Extractor de Tablas PDF  ·  AgroTech Levante Q1 2026

Archivo: informe_Q1_2026_agrotech.pdf  ·  42 páginas  ·  Exportado a CSV · Excel · JSON

4
Tablas extraídas
97,3%
Precisión media
312
Filas procesadas
3
Formatos exportados
📄 PDF
Flavors usados: Lattice Stream
⬇ CSV (×4) ⬇ Excel (.xlsx) ⬇ JSON (×4)
📈 Rendimiento Cultivos 54 filas
💰 Balance Costes 18 filas
🔬 KPIs Calidad 36 filas
📋 Resumen Ejecutivo 204 filas
💻 Código
📦 Exportaciones
Precisión camelot (lattice)
98,6% Página 3-5 · 3 columnas fusionadas gestionadas
Tabla 1/4 Flavor: lattice Páginas: 3–5 Celdas fusionadas: 3 (parcela, cultivo) Forward-fill aplicado
Parcela Cultivo Mes Producción (kg) Área (ha) Rendimiento (kg/ha) Δ vs Q1-25 Estado
NorteAlcachofaEnero12.4508,21.518+8,3%↑ Óptimo
NorteAlcachofaFebrero11.8208,21.441+5,1%↑ Óptimo
NorteAlcachofaMarzo13.1008,21.597+11,2%↑ Óptimo
CentroBrócoliEnero9.2306,01.538-2,1%→ Normal
CentroBrócoliFebrero8.7506,01.458-5,8%↓ Alerta
CentroBrócoliMarzo10.3406,01.723+3,4%↑ Óptimo
SurLechuga IcebergEnero18.60012,51.488+6,7%↑ Óptimo
SurLechuga IcebergFebrero17.94012,51.435+2,3%→ Normal
SurLechuga IcebergMarzo20.15012,51.612+9,8%↑ Óptimo
Vista previa CSV — table_1_rendimiento.csv
Parcela,Cultivo,Mes,Produccion_kg,Area_ha,Rendimiento_kg_ha,Delta_Q1_25,Estado
Norte,Alcachofa,Enero,12450,8.2,1518.29,8.3,Optimo
Norte,Alcachofa,Febrero,11820,8.2,1441.46,5.1,Optimo
Norte,Alcachofa,Marzo,13100,8.2,1597.56,11.2,Optimo
Centro,Brocoli,Enero,9230,6.0,1538.33,-2.1,Normal
Centro,Brocoli,Febrero,8750,6.0,1458.33,-5.8,Alerta
... 48 filas más
Precisión camelot (lattice)
97,2% Página 12 · Símbolos € limpiados · Negativos entre paréntesis convertidos
Tabla 2/4 Flavor: lattice Página: 12 Columnas numéricas: 6 € y comas normalizados
Concepto Parcela Semilla (€) Fertilizante (€) Mano de Obra (€) Maquinaria (€) Otros (€) Total (€)
Coste Q1 2026Norte2.3404.1808.9203.45062019.510
Coste Q1 2026Centro1.8903.6207.3402.98048016.310
Coste Q1 2026Sur3.1205.84011.4504.21078025.400
TOTAL Q1 20267.35013.64027.71010.6401.88061.220
Presupuesto Q17.00013.00027.00011.0002.20060.200
Desviación-350-640-710+360+320-1.020
Precisión camelot (stream)
94,8% Páginas 18-22 · Sin bordes · edge_tol=50 · row_tol=10
Tabla 3/4 Flavor: stream (sin bordes) Páginas: 18–22 Columnas manuales: 5
Lote Cultivo Parcela Índice Brix (°Bx) Calibre (mm) pH Humedad (%) Calificación
ALT-2601AlcachofaNorte8,4726,284,3Premium ★★★
ALT-2602AlcachofaNorte7,9686,483,1Premium ★★★
BRC-2601BrócoliCentro6,11856,889,7Estándar ★★
BRC-2602BrócoliCentro5,81727,090,2Rechazo ★
LEC-2601Lechuga IcebergSur4,22106,695,4Premium ★★★
LEC-2602Lechuga IcebergSur4,52186,594,8Premium ★★★
LEC-2603Lechuga IcebergSur3,91986,996,1Estándar ★★
Precisión camelot (lattice · multi-página)
98,9% Páginas 28-42 · 14 páginas concatenadas · Encabezados duplicados eliminados
Tabla 4/4 Flavor: lattice Páginas: 28–42 (multi-página) 204 filas totales Encabezados duplicados: 13 eliminados
Semana Fecha inicio Parcela Producción (kg) Ingresos (€) Costes (€) Margen (€) Margen (%)
Sem 106/01/2026Norte4.12018.5406.43012.11065,3%
Sem 106/01/2026Centro3.08011.7005.2806.42054,9%
Sem 106/01/2026Sur6.20014.8808.4506.43043,2%
Sem 213/01/2026Norte4.33019.4856.58012.90566,2%
Sem 213/01/2026Sur5.98014.3528.2006.15242,9%
... 199 filas más (semanas 2-13, enero–marzo 2026) ...
TOTAL Q1122.040426.34061.220365.12085,7%
Script de extracción — extract_agrotech.py
Python import camelot, pandas as pd, json

PDF = "informe_Q1_2026_agrotech.pdf"

# ── Tabla 1: Rendimiento cultivos (lattice, páginas 3-5) ──
t1 = camelot.read_pdf(PDF, pages="3-5", flavor="lattice",
                      line_scale=40, process_background=True)
df1 = pd.concat([t.df for t in t1], ignore_index=True)
df1.iloc[:, 0] = df1.iloc[:, 0].replace('', pd.NA).ffill() # forward-fill celdas fusionadas
df1 = df1[~df1.duplicated()] # eliminar encabezados repetidos entre páginas

# ── Tabla 2: Balance costes (lattice, página 12) ──
t2 = camelot.read_pdf(PDF, pages="12", flavor="lattice")
df2 = t2[0].df.copy()
for col in df2.columns[2:]:
    df2[col] = pd.to_numeric(df2[col].str.replace(r'[€.,\s]', '', regex=True), errors='coerce')

# ── Tabla 3: KPIs calidad (stream, páginas 18-22, sin bordes) ──
t3 = camelot.read_pdf(PDF, pages="18-22", flavor="stream",
                      edge_tol=50, row_tol=10)
df3 = pd.concat([t.df for t in t3], ignore_index=True)

# ── Tabla 4: Resumen ejecutivo multi-página (28-42) ──
t4 = camelot.read_pdf(PDF, pages="28-42", flavor="lattice")
dfs = [t.df for t in t4]
df4 = pd.concat(dfs, ignore_index=True)
header = df4.iloc[0]
df4 = df4[~(df4 == header).all(axis=1)] # eliminar 13 encabezados duplicados

# ── Exportar a Excel (4 hojas) ──
with pd.ExcelWriter("agrotech_Q1_2026.xlsx") as writer:
    df1.to_excel(writer, sheet_name="Rendimiento", index=False)
    df2.to_excel(writer, sheet_name="Balance_Costes", index=False)
    df3.to_excel(writer, sheet_name="KPIs_Calidad", index=False)
    df4.to_excel(writer, sheet_name="Resumen_Ejecutivo", index=False)

# ── Exportar CSVs ──
for i, (df, name) in enumerate(zip([df1,df2,df3,df4],
    ["rendimiento","costes","calidad","resumen"])):
    df.to_csv(f"table_{i+1}_{name}.csv", index=False)

print(f"✓ 4 tablas exportadas | 312 filas totales")
Archivos generados
📊
Excel (.xlsx)
Un workbook con 4 hojas, listo para Power BI
1
agrotech_Q1_2026.xlsx
📄
CSV
Un archivo CSV por tabla para procesamiento
4
table_1..4_*.csv
🔷
JSON
Orient=records, indentado, para API / dashboard
4
table_1..4_*.json
Vista previa JSON — table_1_rendimiento.json (primeras 2 filas)
[
  {
    "Parcela": "Norte",
    "Cultivo": "Alcachofa",
    "Mes": "Enero",
    "Produccion_kg": 12450,
    "Area_ha": 8.2,
    "Rendimiento_kg_ha": 1518.29,
    "Delta_Q1_25_pct": 8.3,
    "Estado": "Optimo"
  },
  {
    "Parcela": "Norte",
    "Cultivo": "Alcachofa",
    "Mes": "Febrero",
    "Produccion_kg": 11820,
    "Rendimiento_kg_ha": 1441.46,
    "Estado": "Optimo"
  },
  // ... 52 registros más
]
Log de ejecución
[2026-06-16 09:14:02] INFO  Cargando PDF: informe_Q1_2026_agrotech.pdf (42 páginas)
[2026-06-16 09:14:03] INFO  Tabla 1 — lattice scan páginas 3-5: 3 tablas detectadas, concatenadas
[2026-06-16 09:14:03] OK    Tabla 1: 54 filas × 8 cols | accuracy=98.6% | forward-fill aplicado (col 0, 1)
[2026-06-16 09:14:04] INFO  Tabla 2 — lattice scan página 12: 1 tabla detectada
[2026-06-16 09:14:04] OK    Tabla 2: 18 filas × 8 cols | accuracy=97.2% | 6 columnas numéricas limpiadas (€)
[2026-06-16 09:14:05] WARN  Tabla 3 — lattice sin bordes detectados, cambiando a stream flavor
[2026-06-16 09:14:06] OK    Tabla 3: 36 filas × 8 cols | accuracy=94.8% (stream) | edge_tol=50
[2026-06-16 09:14:08] INFO  Tabla 4 — lattice multi-página (28-42): 14 segmentos concatenados
[2026-06-16 09:14:09] OK    Tabla 4: 204 filas × 8 cols | accuracy=98.9% | 13 encabezados dup. eliminados
[2026-06-16 09:14:09] OK    Excel exportado: agrotech_Q1_2026.xlsx (4 hojas)
[2026-06-16 09:14:09] OK    CSVs exportados: table_1_rendimiento.csv, table_2_costes.csv, table_3_calidad.csv, table_4_resumen.csv
[2026-06-16 09:14:10] OK    JSONs exportados: 4 archivos
[2026-06-16 09:14:10] OK    312 filas totales | 4 tablas | precisión media: 97.3% | tiempo: 8.2 s