Spaces:
Sleeping
Sleeping
Upload appDiplo.py
Browse files- appDiplo.py +13 -22
appDiplo.py
CHANGED
|
@@ -5605,30 +5605,21 @@ def rf_cargaPredecir(dfData, cultivo_seleccionado, provincia_seleccionada,
|
|
| 5605 |
ultimo_anio_historico = int(periodos_historicos_unicos[-1])
|
| 5606 |
|
| 5607 |
# 3. Mapeo de indicadores y definici贸n de la variable objetivo (target)
|
| 5608 |
-
|
| 5609 |
-
|
| 5610 |
-
|
| 5611 |
-
|
| 5612 |
-
|
| 5613 |
}
|
| 5614 |
-
|
| 5615 |
-
|
| 5616 |
-
|
| 5617 |
-
|
| 5618 |
-
|
| 5619 |
-
if target not in df_trabajo.columns:
|
| 5620 |
-
return (None, f"Error: No se encontr贸 la columna objetivo '{target}'.",
|
| 5621 |
-
None, None, None,
|
| 5622 |
-
None, None, None, None, None, None, None, None,
|
| 5623 |
-
None, None, None, None, None)
|
| 5624 |
-
|
| 5625 |
-
unidad_ind = {
|
| 5626 |
-
"SUP.SEMB.[ha]": " ha",
|
| 5627 |
-
"SUP.COS.[ha]": " ha",
|
| 5628 |
-
"REND.[kg/ha]": " kg/ha",
|
| 5629 |
-
"PROD.[ton]": " ton",
|
| 5630 |
}
|
| 5631 |
-
|
|
|
|
|
|
|
| 5632 |
|
| 5633 |
# Separaci贸n de caracter铆sticas (X) y variable objetivo (y)
|
| 5634 |
X = df_trabajo.drop(columns=[target, "periodo"], errors="ignore")
|
|
|
|
| 5605 |
ultimo_anio_historico = int(periodos_historicos_unicos[-1])
|
| 5606 |
|
| 5607 |
# 3. Mapeo de indicadores y definici贸n de la variable objetivo (target)
|
| 5608 |
+
mapa_cols = {
|
| 5609 |
+
'SUP.SEMB.[HA]': 'sup_sem_ha',
|
| 5610 |
+
'SUP.COS.[HA]': 'sup_cos_ha',
|
| 5611 |
+
'REND.[KG/HA]': 'rend_kgxha',
|
| 5612 |
+
'PROD.[TON]': 'prod_ton'
|
| 5613 |
}
|
| 5614 |
+
mapa_unidad = {
|
| 5615 |
+
'SUP.SEMB.[HA]': ' ha',
|
| 5616 |
+
'SUP.COS.[HA]': ' ha',
|
| 5617 |
+
'REND.[KG/HA]': ' kg/ha',
|
| 5618 |
+
'PROD.[TON]': ' ton'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5619 |
}
|
| 5620 |
+
clave = str(indicador_nc).strip().upper()
|
| 5621 |
+
indicador = mapa_cols.get(clave, indicador_nc)
|
| 5622 |
+
unidad = mapa_unidad.get(clave, "")
|
| 5623 |
|
| 5624 |
# Separaci贸n de caracter铆sticas (X) y variable objetivo (y)
|
| 5625 |
X = df_trabajo.drop(columns=[target, "periodo"], errors="ignore")
|