Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions data_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,10 @@ def _get_departamento_data_impl(datos, depto):
midagri = datos["midagri"]
materia = datos["materia"]

# Filtrar MIDAGRI por departamento (sin copy — solo lectura)
df_depto = midagri[midagri["DEPARTAMENTO"] == depto_upper]
# Filtrar MIDAGRI por departamento. .copy() explícito: más abajo se le
# agrega la columna "_fecha"; sin la copia es un slice y pandas emite
# SettingWithCopyWarning (y el resultado podría no escribirse).
df_depto = midagri[midagri["DEPARTAMENTO"] == depto_upper].copy()
mat_depto = materia[materia["DEPARTAMENTO"] == depto_upper]

# Datos estáticos del departamento
Expand Down
5 changes: 4 additions & 1 deletion gen_excel_eme.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ def generate_reporte_eme(datos):

# Distritos por departamento
if "DISTRITO" in midagri.columns and "PROVINCIA" in midagri.columns:
# include_groups=False: pandas>=2.2 deprecó que apply opere sobre la
# columna de agrupación. _build_district_text solo usa PROVINCIA/DISTRITO
# (no DEPARTAMENTO), así que excluirla no cambia el resultado.
dist_info = midagri.groupby("DEPARTAMENTO").apply(
lambda g: _build_district_text(g)
lambda g: _build_district_text(g), include_groups=False
).reset_index()
dist_info.columns = ["DEPARTAMENTO", "DISTRITOS"]
dept_data = dept_data.merge(dist_info, on="DEPARTAMENTO", how="left")
Expand Down
Loading