Skip to content

Commit

Permalink
remove de-aggregation in frozen group output
Browse files Browse the repository at this point in the history
  • Loading branch information
AnneONS committed Feb 4, 2025
1 parent 91f661a commit 2b3cc49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/outputs/frozen_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def output_frozen_group(
config: Dict[str, Any],
intram_tot_dict: Dict[str, int],
write_csv: Callable,
deduplicate: bool = True,
deduplicate: bool = False,
) -> Dict[str, int]:
"""Creates a "frozen group" output for the entire UK. In BERD (GB) data,
creates foreign ownership and cora status. Selects the columns we need for
Expand Down Expand Up @@ -175,6 +175,9 @@ def output_frozen_group(
df = pd.concat([df_gb_need, df_ni_need], ignore_index=True, axis=0)

# Deduplicate by aggregation
# TODO: this code fails in DAP for PNP. Think whether it's necessary and
# TODO then refactor this, using a list of columns from the config
# TODO and considering whether there are extra cols in the PNP case.
if deduplicate:
df_agg = df.groupby(category_columns).agg("sum").reset_index()
else:
Expand Down Expand Up @@ -206,6 +209,6 @@ def output_frozen_group(

# Outputting the CSV file
filename = filename_amender("output_frozen_group", config)
write_csv(f"{output_path}output_frozen_group/{filename}", output)
write_csv(f"{output_path}/output_frozen_group/{filename}", output)

return intram_tot_dict
2 changes: 1 addition & 1 deletion src/user_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ config_validation:
validate: True
path: src/user_config_schema.yaml
survey:
survey_type: "BERD"
survey_type: "PNP"
survey_year: 2023
global:
# Staging and validation settings
Expand Down

0 comments on commit 2b3cc49

Please sign in to comment.