Skip to content

Commit 58368ee

Browse files
authored
Merge pull request #184 from FEWS-NET/HEA-780/MW12_TypeError_unsupported-operand-type_for_float_and_str
Add coverstion to numeric value before the aggregates
2 parents c025c06 + 3de3466 commit 58368ee

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pipelines/assets/livelihood_activity.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,8 @@ def get_annotated_instances_from_dataframe(
13371337
# Annotate the output metadata with completeness information
13381338
# Get the summary dataframe, grouped by strategy_type
13391339
summary_df = pd.DataFrame(reported_summary_output.value["LivelihoodActivity"])
1340+
for col in ["income", "expenditure", "kcals_consumed"]:
1341+
summary_df[col] = pd.to_numeric(summary_df[col], errors="coerce").fillna(0)
13401342
summary_df = (
13411343
summary_df[["strategy_type", "income", "expenditure", "kcals_consumed"]].groupby("strategy_type").sum()
13421344
)

0 commit comments

Comments
 (0)