Skip to content

Commit

Permalink
fix grouping issue on secondary summary generation (#2370)
Browse files Browse the repository at this point in the history
  • Loading branch information
susilnem authored Jan 3, 2025
1 parent 2a4414b commit e1ee468
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions per/ops_learning_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,6 @@ def _contextualize_learnings(df):
df.at[index, "learning"] = (
f"{row['excerpts_id']}. In {row['appeal_year']} in {row['appeal_name']}: {row['learning']}"
)

df = df.drop(columns=["appeal_name"])
logger.info("Contextualization added to DataFrame.")
return df

Expand Down Expand Up @@ -561,7 +559,7 @@ def seconday_prioritize_excerpts(cls, df: pd.DataFrame):
secondary_learning_df = df.drop_duplicates(subset=["learning", "component", "sector"]).sort_values(
by=["appeal_name", "component", "appeal_year"], ascending=[True, True, False]
)
grouped = secondary_learning_df.groupby("component", "appeal_name")
grouped = secondary_learning_df.groupby(["component", "appeal_name"])

# Create an interleaved list of rows
interleaved = list(chain(*zip_longest(*[group[1].itertuples(index=False) for group in grouped], fillvalue=None)))
Expand Down

0 comments on commit e1ee468

Please sign in to comment.