Skip to content

Commit 3de3466

Browse files
authored
Update numeric conversion to fill NaN with 0 - see HEA-780
Ensure numeric conversion fills NaN values with 0.
1 parent 3325abf commit 3de3466

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pipelines/assets/livelihood_activity.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,8 +1338,7 @@ def get_annotated_instances_from_dataframe(
13381338
# Get the summary dataframe, grouped by strategy_type
13391339
summary_df = pd.DataFrame(reported_summary_output.value["LivelihoodActivity"])
13401340
for col in ["income", "expenditure", "kcals_consumed"]:
1341-
summary_df[col] = pd.to_numeric(summary_df[col], errors="coerce")
1342-
1341+
summary_df[col] = pd.to_numeric(summary_df[col], errors="coerce").fillna(0)
13431342
summary_df = (
13441343
summary_df[["strategy_type", "income", "expenditure", "kcals_consumed"]].groupby("strategy_type").sum()
13451344
)

0 commit comments

Comments
 (0)