maferrara1961 commited on
Commit
a0bfa9f
路
verified 路
1 Parent(s): 53949a0

Upload appDiplo.py

Browse files
Files changed (1) hide show
  1. 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
- dict_ncortos = {
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
- indicador = dict_ncortos.get(
5615
- indicador_seleccionado, indicador_seleccionado
5616
- )
5617
- target = indicador
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
- unidad = unidad_ind.get(indicador_seleccionado, "")
 
 
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")